I have the following python dictionary:
d= {'data' : Counter({ 'important' : 2,
'very' : 3}),
'analytics' : Counter({ 'boring' : 5,
'sleep' : 3})
}
I want to save it as a pandas dataframe in the following format:
category | word | count
data | important | 2
data | very | 3
analytics | boring | 5
analytics | sleep | 3
I tried the following, but none of it worked
df = pd.DataFrame(d.items())
df = pd.DataFrame.from_dict(d, orient='index').reset_index()
df = pd.DataFrame(data)