Import pandas dataframe column as string not int

Import pandas dataframe column as string not int

Asked on December 24, 2018 in Pandas.
Add Comment


  • 1 Answer(s)

    The below code works for the version 0.9.1 and up:

    In [2]: read_csv('sample.csv', dtype={'ID': object})
    Out[2]:
                              ID
    0 00013007854817840016671868
    1 00013007854817840016749251
    2 00013007854817840016754630
    3 00013007854817840016781876
    4 00013007854817840017028824
    5 00013007854817840017963235
    6 00013007854817840018860166
    

    Refer https://github.com/pandas-dev/pandas/issues/2247.

    Answered on December 24, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.