{"id":7445,"date":"2021-05-30T09:15:44","date_gmt":"2021-05-30T03:45:44","guid":{"rendered":"https:\/\/python-programs.com\/?p=7445"},"modified":"2021-11-22T18:53:35","modified_gmt":"2021-11-22T13:23:35","slug":"pandas-create-dataframe-from-list-of-dictionaries","status":"publish","type":"post","link":"https:\/\/python-programs.com\/pandas-create-dataframe-from-list-of-dictionaries\/","title":{"rendered":"Pandas: Create Dataframe from List of Dictionaries"},"content":{"rendered":"

Methods of creating a dataframe from a list of dictionaries<\/h2>\n

In this article, we discuss different methods by which we can create a dataframe from a list of dictionaries. Before going to the actual article let us done some observations that help to understand the concept easily. Suppose we have a list of dictionary:-<\/p>\n

list_of_dict = [
\n{'Name': 'Mayank' , 'Age': 25, 'Marks': 91},
\n{'Name': 'Raj', 'Age': 21, 'Marks': 97},
\n{'Name': 'Rahul', 'Age': 23, 'Marks': 79},
\n{'Name': 'Manish' , 'Age': 23},
\n]<\/code><\/p>\n

Here we know that dictionaries consist of key-value pairs. So we can analyze that if we make the key as our column name and values as the column value then a dataframe is easily created. And we have a list of dictionaries so a dataframe with multiple rows also.<\/p>\n

pandas.DataFrame<\/h3>\n

This methods helps us to create dataframe in python<\/p>\n

syntax: pandas.<\/span>DataFrame<\/span>(<\/span>data=<\/span>None<\/span>, index=<\/span>None<\/span>, columns=<\/span>None<\/span>, dtype=<\/span>None<\/span>, copy=<\/span>False<\/span>)<\/span><\/code><\/p>\n

Let us see different methods to create dataframe from a list of dictionaries<\/h3>\n