I have a set of data with date formate in dd/mm/YY HH:MM
I try to separate the data into weekday and weekend.
Therefore, I add a column as weekday to my data called df
temp = pd.DatetimeIndex(df['date'])
df['weekday'] = temp.weekday
It works fine, but it recognize the date as mm/dd/YY HH:MM
then I tried
df['DATE'] = datetime.datetime.strptime(df['date'], "%d/%m/%Y %HH:%MM")
.strftime("%m-%d-%Y %HH:%MM")
However, an error comes out
must be string, not Series,
Is there any way to let the program read date correctly?
Best,
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 134.197.56.9
※ 文章網址: https://www.ptt.cc/bbs/Programming/M.1435708054.A.57C.html