I am trying to convert a list into dataframe using python. I have all the necessary data in my list(correct data), in the form of list of dictonaries. See list of dictonaries below:
[{'ABC': 'abc1', 'DEF': 'def1', 'GHI': 'ghi1', 'JKL': 'jkl1', 'MNO': 'mno1', 'PQR': 'pqr1', 'STU': 'stu1', 'VWX': 'vwx1', 'YZ': 'yz1'},
{'ABC': 'abc2', 'DEF': 'def2', 'GHI': 'ghi2', 'JKL': 'jkl2', 'MNO': 'mno2', 'PQR': 'pqr2', 'STU': 'stu2', 'VWX': 'vwx2', 'YZ': 'yz2'},......
I am using the following command to convert it to a dataframe.
newdf = pd.DataFrame.from_dict(case_list_new)
Instead of taking the dictionary keys as column headers, the dataframe is taking the numbers 0-8 as column headers, and printing the column names in a loop where the dictionary values should be. This is the dataframe output I get :
0 1 2 3 4 5 6 7 8
0 ABC DEF GHI JKL MNO PQR STU VWX YZ
1 ABC DEF GHI JKL MNO PQR STU VWX YZ
What could be the reason for this output and how may I put it right ? Any help would be hugely appreciated.