2017-03-29 104 views
0

我有一個看起來像這樣多個原始數據字典:創建Python字典的一個超集

raw_data1 = {'Series_Date':['2017-03-10','2017-03-13','2017-03-14','2017-03-15'],'SP':[35.6,56.7,41,41],'1M':[-7.8,56,56,-3.4],'3M':[24,-31,53,5]} 
raw_data2 = {'Series_Date':['2017-03-10','2017-03-13','2017-03-14','2017-03-15'],'SP':[35.6,56.7,41,41],'1M':[-7.8,56,56,-3.4],'3M':[24,-31,53,5]} 
raw_data3 = {'Series_Date':['2017-03-10','2017-03-13','2017-03-14','2017-03-15'],'SP':[35.6,56.7,41,41],'1M':[-7.8,56,56,-3.4],'3M':[24,-31,53,5]} 

我想這些在頂級詞典相結合,使得每個元素的關鍵是raw_data1/raw_data2/raw_data3等,其值是單個字典本身。任何想法如何創建這樣的字典?

回答

3

只需創建這些密鑰的新字典,並使用這些字典作爲鍵的值:

top_dictionary = { 
    'raw_data1': raw_data1, 
    'raw_data2': raw_data2, 
    'raw_data3': raw_data3 
}