How to get pandas.read_csv not to perform any conversions?

后端 未结 1 1659
暗喜
暗喜 2021-01-20 10:45

For example, the values in \'/tmp/test.csv\' (namely, 01, 02, 03) are meant to represent strings that happen to match /

相关标签:
1条回答
  • 2021-01-20 11:23

    df = pd.read_csv('temp.csv', dtype=str)

    From the docs:

    dtype : Type name or dict of column -> type, default None
    Data type for data or columns. E.g. {‘a’: np.float64, ‘b’: np.int32} (Unsupported with engine=’python’). Use str or object to preserve and not interpret dtype.
    
    0 讨论(0)
提交回复
热议问题