[問題] python pandas time shift

看板Programming作者 (....)時間10年前 (2015/07/01 07:47), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
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
文章代碼(AID): #1LaogMLy (Programming)
文章代碼(AID): #1LaogMLy (Programming)