{"id":8112,"date":"2021-02-17T22:04:24","date_gmt":"2021-02-17T16:34:24","guid":{"rendered":"https:\/\/pynative.com\/?p=8112"},"modified":"2023-03-09T11:53:38","modified_gmt":"2023-03-09T06:23:38","slug":"convert-pandas-dataframe-to-dict","status":"publish","type":"post","link":"https:\/\/pynative.com\/convert-pandas-dataframe-to-dict\/","title":{"rendered":"Convert Pandas DataFrame to Python dictionary"},"content":{"rendered":"\n

In this article, you will learn how to convert pandas DataFrame<\/a> into a Python dictionary<\/a>. It explains creating different kinds of dictionaries from pandas DataFrame.<\/p>\n\n\n\n

Data Analyst needs to collect the data from heterogeneous sources like CSV files or SQL tables or Python data structures like a dictionary, list, etc. Such data is converted into pandas DataFrame. <\/p>\n\n\n\n

After analyzing the data, we need to convert the resultant DataFrame back to its original format like CSV files or a dictionary. Or sometimes, we need to convert it into some other form. <\/p>\n\n\n\n

Table of contents<\/h2>