#把时间列标准化时间格式
df['time_slot1']=pd.to_datetime(df['time_slot1'])
#输出这一天是周中的第几天,Monday=0, Sunday=6
df['dayofweek']=df['time_slot1'].dt.dayofweek
pandas从时间序列中判断是一周的第几天或星期几
于 2023-09-11 21:36:24 首次发布
#把时间列标准化时间格式
df['time_slot1']=pd.to_datetime(df['time_slot1'])
#输出这一天是周中的第几天,Monday=0, Sunday=6
df['dayofweek']=df['time_slot1'].dt.dayofweek