Sometimes, we want to convert Python dict into a dataframe with Pandas.
In this article, we’ll look at how to convert Python dict into a dataframe with Pandas.
How to convert Python dict into a dataframe with Pandas?
To convert Python dict into a dataframe with Pandas, we can use the pandas.DataFrame.from_dict method.
For instance, we write
df = pandas.DataFrame.from_dict(
    {
        u"2012-06-08": 388,
        u"2022-06-09": 388,
        u"2022-06-10": 388,
        u"2022-06-11": 389,
        u"2022-06-12": 389,
        # ...
        u"2022-07-05": 392,
        u"2022-07-06": 392,
    },
    orient="index",
    columns=["foo"],
)
to call pandas.DataFrame.from_dict with a dict.
Then we set the columns argument to foo to put the values in the foo column.
Conclusion
To convert Python dict into a dataframe with Pandas, we can use the pandas.DataFrame.from_dict method.
 
							