-3

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?

Kevin
  • 74,910
  • 12
  • 133
  • 166
stefanodv
  • 463
  • 3
  • 11
  • 20
  • 1
    See here: https://stackoverflow.com/questions/13293810/import-pandas-dataframe-column-as-string-not-int – KuboMD Jan 18 '19 at 17:23

1 Answers1

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