I want to pass a list of dicts into a dataframe:
mylist_of_dicts= [{'H1': 2},
{'H2': 2},
{'H3': 3},
{'H4': 2},
{'H5': 2},
{'B6': 2},
{'H7': 2},
{'H8': 2}]
cl_ocurrences = pd.DataFrame(mylist)
print(cl_ocurrences.head(2))
cl_ocurrences = pd.DataFrame.from_dict(mylist)
print(cl_ocurrences.head(2))
cl_ocurrences = pd.DataFrame.from_records(mylist)
print(cl_ocurrences.head(2))
But I would like that the keys appear in a column and the values in other column.
I could play around with list comprehensions and pass two lists (values and keys) to the DF constructor, but there should be a nicer way.