pandas的string日期列转化为timestamp(时间戳)

pd.to_datetime

df["年月日"] = pd.to_datetime(df["年月日"])

实例:

df.head()

在这里插入图片描述

#将年月日列从string转为timestamp(时间戳)
df["年月日"] = pd.to_datetime(df["年月日"])
df.head()

在这里插入图片描述

发布了102 篇原创文章 · 获赞 101 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/weixin_43124279/article/details/104343357