Given a dictionary such as:
records = {0:{'name':'John', 'salary':'5000'}, 1:{'name':'Bob', 'salary':'3500'}}
If I want to get and store (in csv) a dataframe such as:
name salary
John 5000
By using records[0] as a way to access the dictionary inside, how would I do that?
I have tried:
df = pd.DataFrame(records[0], index=[0])
df= pd.DataFrame(list(records[0].values()), columns=list(records[0].keys()))
df= pd.DataFrame.from_dict(records[key], orient='columns')
But none of them worked as intended (2nd one gave me an error, 1st and last have just one column)