看板 Python 關於我們 聯絡資訊
請教板上各位先進, 因為抓取政府的公開資料, 可是日期格式為106.09.01 我想將日期作為index, 便將資料拆解為下表, 我看了join等接合方法, 但沒找到相符的語法 請問要如何才能將資料重新結合為 2016.09.01呢? 感謝解惑 年 月 日 0 2016 09 01 . . . 29 2016 09 30 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 42.73.230.49 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1506411644.A.ACA.html
painkiller: df['年'].astype(str)+'.'+df['月'].astype(str) 09/26 21:17
steveyeh987: df[['年','月','日′]].apply(lambda x : '{}.{}.{}' 09/27 01:46
steveyeh987: .format(x[0],x[1],x[2]), axis=1) 09/27 01:46
f496328mm: py也有apply?不知道跟R的像不像 09/28 02:03
Sunal: 這是pandas的apply 09/28 10:43
hiddenwind: 可以了,感謝大大 09/29 09:52