我有一个数据框列,其值如下
$none
1558044313727
$none
1558058614585
...
我尝试了下面的查询,事件带有errors='ignore'
它没有转换
df['epoch_date'] = pd.to_datetime(df['epoch_date'], unit='ms')
ERROR: ValueError: non convertible value $none with the unit 'ms'
如何忽略$none或将其转换为NaN值,并使用datetime值进行休息
Tags:
尝试使用
errors = 'coerce'
:这将把
'$none'
值(以及任何其他无效解析)转换为NaT
,这是datetime64[ns]
类型的NaN
等价值errors = 'ignore'
失败,因为它只是在无效解析时返回输入,所以最后它试图将字符串放入datetime对象,但由于明显的原因失败了相关问题 更多 >
编程相关推荐