1
我正在處理字典列表具有相同鍵的問題,我想將所有值彙總到每個鍵的列表中。Pandas Groupby字典列表到一本字典
x = [
{'firstName': 'Tom', 'lastName': 'Fyre', 'email': '[email protected]'},
{'firstName': 'Jerry', 'lastName': 'Brat', 'email': '[email protected]'},
{'firstName': 'Phil', 'lastName': 'Hughes', 'email': '[email protected]'}
]
我想上面的詞典列表轉換爲一個字典,它看起來像:
results = {
'firstName': ['Tom', 'Jerry', 'Phil'],
'lastName': ['Fyre', 'Brat', 'Hughes'],
'email': ['[email protected]', '[email protected]', '[email protected]']
}