Python:更改日期时间格式

2024-09-25 06:30:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个数据框:

enter image description here

我想将日期格式从“%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"))

我试过这个函数,它适用于某些行,而其他行不行

enter image description here


Tags: to数据lambda函数datadatetimedate格式