In [ ]:
import pandas as pd
In [1]:
sample_dict1 = {'0':['a','b','c'], '1':['d','e']}
sample_dict2 = {'0':['k'], '2':['z']}
In [3]:
sample_dict1.get('0')
Out[3]:
In [4]:
sample_dict2.get('0')
Out[4]:
In [5]:
sample_dict1.get('0') + sample_dict2.get('0')
Out[5]:
In [6]:
sample_dict1.keys()
Out[6]:
In [ ]:
test_dict = {}
dir_path = '/path/'
for i in os.listdir(dir_path):
with open(i) as json_data:
data = json.load(json_data)
for j in data.keys():
try:
if test_dict[j]:
pass
except:
test_dict.setdefault(j,[])
test_dict[j] = test_dict.get(j) + data.get(j)
In [ ]:
df = pd.DataFrame(dict([ (k,pd.Series(v)) for k,v in test_dict.items() ]))