python - Pandas option to treat leading zeros entry as string -
is there read_csv option parse columns leading zeros strings? i've seen suggestions preprocess , modify csv add quotes, wondering if 1 of 52 kwargs options can me.
similar this question, explicitly asking if there's pandas option, rather preprocessing or manually passing dtype={strcols:object}.
ask, , shall receive. specify dtype dictionary of {column name: type} :
in [22]: s = """0001,2 0002,3 """ in [23]: pd.read_csv(stringio(s), header=none, dtype={0: str}) out[23]: 0 1 0 0001 2 1 0002 3 [2 rows x 2 columns]
Comments
Post a Comment