2024-09-25 06:30:03 发布
网友
我有一个数据框:
我想将日期格式从“%d/%m/%y”更改为“%m/%d/%y”
all_data["Date demande1"]=all_data["Date demande"].apply(lambda x: datetime.strftime(pd.to_datetime(x), "%m/%d/%Y"))
我试过这个函数,它适用于某些行,而其他行不行
all_data["Date demande1"]=all_data["Date demande"].apply(lambda x: datetime.strftime(pd.to_datetime(x, format="%d/%m/%Y %H:%M", errors='ignore'), "%m/%d/%Y"))
相关问题 更多 >
编程相关推荐