Pandas is a high-level data manipulation tool commonly used in python. It is build on Numpy and the key data structure is DataFrame.
Here I am explaining a sample python program to convert a Pandas Dataframe into a list of dictionaries.
Program to convert Dataframe into list of dictionaries
In the below program, we are reading a csv file and loading it in pandas. You can configure the delimiter as per your requirement. The required_fields is an optional parameter that can be used to limit or select the required fields in the Dataframe from the csv. By default, it picks up all the fields in the file.
No comments:
Post a Comment