📜  python dt 错误仅与 datetimelike 值一起使用 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:14.239000             🧑  作者: Mango

代码示例1
# Your problem here may be that to_datetime silently failed so the dtype remained as str/object, 
# if you set param errors='coerce' then if the conversion fails for any particular string 
# then those rows are set to NaT.

df['Date'] = pd.to_datetime(df['Date'], errors='coerce')