看板 Python 關於我們 聯絡資訊
http://i.imgur.com/xUTk3Ib.jpg 請問要怎麼把前面的dict value不要存取 我有試著存到另一個list 印出來還是有dictvalue http://i.imgur.com/oQoibeh.jpg 這是我的程式碼 我只想要存value內部的值而已 本來的架構是 {time stamp : 時間 , s_d0 :數值,s_h0:數值,s_t0:數值 } ----- Sent from JPTT on my OPPO CPH1701. -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 223.138.51.78 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1575190397.A.ACB.html ※ 編輯: lucy35 (223.138.51.78 臺灣), 12/01/2019 16:55:28
ckc1ark: for item in air: print(list(item.values())) 12/01 16:59
ckc1ark: 不過印出來應該不是你的目的 要看你要對這些value做什麼 12/01 17:00
ckc1ark: 不一定要是list才能操作 12/01 17:00
我想要把值存進mysql裡 ※ 編輯: lucy35 (223.138.51.78 臺灣), 12/01/2019 18:21:07
hongyan: pandas 搭配 sqlalchemy 12/01 21:39
hongyan: 可以先用concat清洗dict 12/01 21:41
hongyan: pd.dataframe.from_dict後 to_sql 就很方便了 12/01 21:44
hongyan: 更正一下 先把dict轉df後再用concat或merge清洗合併 12/01 21:54
ariel777: for key,value in air.items(): 12/08 21:53
ariel777: list.append(value) 12/08 21:53
ariel777: 就可以了! 12/08 21:53