df.date = df.date.apply(pd.to_datetime)
df['month'] = df.date.apply(lambda x: x.month)
df['day'] = df.date.apply(lambda x: x.day)
df['year'] = df.date.apply(lambda x: x.year)
df.drop(['date'], 1, inplace = True)
df.head(3)
Pandas实战教程 | 拆开年月日
猜你喜欢
转载自blog.csdn.net/qq_38251616/article/details/125004391
今日推荐
周排行