pandas.to_datetime() 只保留【年-月-日】

Outline

pandas.to_datetime()  生成的日期会默认带有 【2019-07-03 00:00:00】的分钟精度;
但有时并不需要这些分钟精度;

去掉分钟精度

可以通过pandas中的 .dt.date 去掉分钟。

df['just_date'] = df['dates'].dt.date

padnas 版本 要大于等于 0.15.0

猜你喜欢

转载自www.cnblogs.com/bigtreei/p/11126805.html