我有一个JSON数据,
[[{'Design Project': 'Not Available',
'Design Target*': 'Not Available',
'Median Property*': '50',
'Metric': 'ENERGY STAR score (1-100)'},
{'Design Project': 'Not Available',
'Design Target*': '35.4',
'Median Property*': '141.4',
'Metric': 'Source EUI (kBtu/ft²)'},
{'Design Project': 'Not Available',
'Design Target*': '15.8',
'Median Property*': '63.1',
'Metric': 'Site EUI (kBtu/ft²)'},
{'Design Project': 'Not Available',
'Design Target*': '3,536.0',
'Median Property*': '14,144.1',
'Metric': 'Source Energy Use (kBtu)'},
{'Design Project': 'Not Available',
'Design Target*': '1,578.7',
'Median Property*': '6,314.9',
'Metric': 'Site Energy Use (kBtu)'},
{'Design Project': 'Not Available',
'Design Target*': '34.61',
'Median Property*': '138.44',
'Metric': 'Energy Cost ($)'},
{'Design Project': '0.0',
'Design Target*': '0.2',
'Median Property*': '0.6',
'Metric': 'Total GHG Emissions (Metric Tons CO2e)'}],
[{'Energy Type': ['Energy Not Entered',
'Assumed Mix Based on State & Property Type:',
'',
'Electric - Grid (56.9%)',
'Natural Gas (43.1%)'],
'Target': ' Target % Better than Median: 75',
'Title': "About this Property's Design",
'Uses:': 'Other - Education (100.0%)'}],
[{'Your Design Score ': ' N/A'}]]
我想从Json中删除Key,因为在我的Postgres表中,key是我的列。我想将值插入我的列。
我想用Python做到这一点。
答案 0 :(得分:1)
def f(l_of_l_of_ds):
return [list(l2.values())
for l1 in l_of_l_of_ds
for l2 in l1]
哪个收益率:
[['Not Available', 'Not Available', '50', 'ENERGY STAR score (1-100)'],
['Not Available', '35.4', '141.4', 'Source EUI (kBtu/ft²)'],
['Not Available', '15.8', '63.1', 'Site EUI (kBtu/ft²)'],
['Not Available', '3,536.0', '14,144.1', 'Source Energy Use (kBtu)'],
['Not Available', '1,578.7', '6,314.9', 'Site Energy Use (kBtu)'],
['Not Available', '34.61', '138.44', 'Energy Cost ($)'],
['0.0', '0.2', '0.6', 'Total GHG Emissions (Metric Tons CO2e)'],
[['Energy Not Entered',
'Assumed Mix Based on State & Property Type:',
'',
'Electric - Grid (56.9%)',
'Natural Gas (43.1%)'],
' Target % Better than Median: 75',
"About this Property's Design",
'Other - Education (100.0%)'],
[' N/A']]