但是,熊猫在读取object类型时自动将字符串转换为int64类型。df = pandas.DataFrame({'col1':['00123','00125']}) df.to_csv('test.csv',indexint64 #value of second print
如何在写入时保留dtype或在读时防止更改?
当在Dataframe中转换列的类型时,我面临一个溢出问题。_mgr.astype(dtype=dtype, copy=copy, errors=errors,)
File "/usr/local/lib/python3.6/dist-packages/pandas/core/internals/managers.py", line 604, in astype</e
我有一个Pandasdataframe,它作为一个“object”存储,但是我需要将dataframe结构更改为'int‘,因为'object’dtype将不会在numpy库的kmeans()函数中处理#create subset of user variables user.views = user.views.astype('int')
us