将pandas系列时间戳转换为唯一日期列表

2024-04-26 00:30:21 发布

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

我有一个时间戳格式的pandas数据框列,希望将唯一日期(无时间)提取到列表中。我试过以下的方法都不管用

1. dates =  datetime.datetime(df['EventTime'].tolist()).date()
2. dates =  pd.to_datetime(df['EventTime']).date().tolist()
3. dates =  pd.to_datetime(df['EventTime']).tolist().date()

有人能帮忙吗?


Tags: to数据方法pandasdf列表datetimedate