series序列中每个元素都是带有日期形式的字符串,需要将其转化为一个同等大小的series,且其中每个元素都是星期几。
1)将Series转化为datetime格式;
2)将Series中每个元素转化为星期;
time_list = ["2017-05-10 17:19:19", "2017-05-11 17:19:20", "2017-05-12 17:19:20", "2017-05-13 17:19:20"]
time_ser = pd.Series(time_list)
time_ser = pd.to_datetime(time_ser)
for i in time_ser:
print(i.weekday())