Reputation: 309
My text file has values like this:
00001
00002
00003
The pandas.read_csv
function reads the values as 1, 2, 3
. I want them to be read in raw format as 00001
etc.
How can I do this?
Upvotes: 2
Views: 453
Reputation: 294258
converters
The key 0
in the dictionary {0: str}
refers to either the column name or position. In this case, it is both.
pd.read_csv('tst.csv', header=None, converters={0: str})
0
0 00001
1 00002
2 00003
Upvotes: 4