【发布时间】:2020-11-06 16:25:23
【问题描述】:
我的列类型有问题。
该列是这样的:
# df
col1
0.7368
0.5
NaT
0.2
print(df.dtypes)
col1 object
我想将col1 更改为float 数据类型,但得到了TypeError。
df.col1_new = df.col1.astype(float)
TypeError: float() argument must be a string or a number, not 'NaTType'
我需要将NaT 更改为空格吗?我认为NaT应该被视为失踪......
【问题讨论】:
标签: python pandas data-manipulation