python dataframe日期格式转换

#获取周一,周二.....
lexin_df['weekday'] = lexin_df['approve_date'].map(lambda x:x.weekday()+1)
#获取小时
lexin_df['hour'] = lexin_df['approve_date'].map(lambda x:x.hour)
#时间格式转字符串
lexin_df['approve_month'] = lexin_df['approve_date'].map(lambda x:x.strftime('%Y-%m'))

 

posted @ 2022-03-25 11:42  地豆苗  阅读(782)  评论(0)    收藏  举报