I'm importing data from excel with pandas. A column of my dataframe contains some strings of numbers with 0 as the first character and python transforms it into integer. For example 0700 is placed 700. How to not alter the value and consider it as a string with 0 in front?
Asked
Active
Viewed 88 times
1 Answers
0
By using the 'converters' parameter on your dataframe statement, e.g.
df = pd.read_excel('*workbook name here',sheetname='*sheet name here',header=0,converters={'*integer column name here':str})

visualnotsobasic
- 428
- 3
- 17