Answers for "dict to csv keys as rows and subkey as columns in python"

0

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

import pandas as pd
dic = {"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}}
pd.DataFrame.from_dict(dic, orient='index').to_csv('temp.csv')
Posted by: Guest on June-20-2020

Code answers related to "dict to csv keys as rows and subkey as columns in python"

Python Answers by Framework

Browse Popular Code Answers by Language