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'))