我有这个 json 数据集。从这个数据集中,我只想要“column_names”键及其值和“data”键及其值。column_names 的每个值对应于数据值。我如何在python中只组合这两个键进行分析
{"dataset":{"id":42635350,"dataset_code":"MSFT","column_names":
["Date","Open","High","Low","Close","Volume","Dividend","Split",
"Adj_Open","Adj_High","Adj_Low","Adj_Close","Adj_Volume"],
"frequency":"daily","type":"Time Series",
"data":[["2017-12-28",85.9,85.93,85.55,85.72,10594344.0,0.0,1.0,83.1976157998082,
83.22667201021558,82.85862667838872,83.0232785373639,10594344.0],
["2017-12-27",85.65,85.98,85.215,85.71,14678025.0,0.0,1.0,82.95548071308001,
83.27509902756123,82.53416566217294,83.01359313389476,14678025.0]
for cnames in data['dataset']['column_names']:
print(cnames)
for cdata in data['dataset']['data']:
print(cdata)
For 循环给了我想要的列名和数据值,但我不知道如何将它组合起来,并将其作为 python 数据框进行分析。
Ref:以上代码来自qudal网站
慕田峪9158850
慕娘9325324
慕妹3242003
相关分类