'How can I preserve leading zeros when exporting sql query output as a csv file?
The SQL column containing leading zeros is a varchar. When I export as an excel file, the leading zeros are preserved. However, when I export as csv, the leading zeros are gone.
When I upload the excel data output file into python using pandas pd.ExcelFile, the leading zeros are also gone in the pandas dataframe. Datatype in the pandas dataframe for this column in int64.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
