dict to csv keys as rows and subkey as columns in python

Solutions on MaxInterview for dict to csv keys as rows and subkey as columns in python by the best coders in the world

showing results for - "dict to csv keys as rows and subkey as columns in python"
Louis
15 Jul 2017
1import pandas as pd
2dic = {"Location1":{"a":1,"b":2,"c":3},"Location2":{"a":4,"b":5,"c":6}, "Location3":{'e':7,'f':8, 'g':9, 'h':10}, "Location4":{'e': 2, 'f': 3, 'g': 4, 'h': 5}}
3pd.DataFrame.from_dict(dic, orient='index').to_csv('temp.csv')
similar questions