我有CSV文件,其中包含一些带有日期时间的信息。我提取了datetime并将其转换为如下日期:
daily_readings={"Date":[]}
TIME = df.iloc[4,4]
report_date = pd.to_datetime(TIME).date()
if report_date not in daily_readings['Date']:
daily_readings['Date'].append(report_date)
我同时导入了datetime和time库(不确定我是否真的需要这两个库)。当我打印字典的时候
print(daily_readings['Date'])
我得到这个输出:
[datetime.date(2021,12,7),datetime.date(2021,12,8)]
但当我打印可变报告时_date:
print(report_date)
我有一个干净的约会,像这样:
2021-12-08
.
那么,我怎样才能让字典里的日期如图所示的那样清晰呢?