ValueError: Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
解决ValueError: Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
报错代码
pd.to_datetime(data['Formatted Date'], errors='coerce')
报错日志
ValueError: Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
解决办法
pd.to_datetime(data['Formatted Date'], errors='coerce',utc=True)
utc=True
报错原因
to_datetime()转换失败,转换前类型为object,转换后类型应该是datetime64[ns, UTC])
欢迎大家交流学习,任何问题都可以留言
还没有评论,来说两句吧...