Skip to content

flatten data (nested dictionaries and lists) to prepare it for pandas dataframe

License

Notifications You must be signed in to change notification settings

dacog/flatten_data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flatten-data

I found a great function from Thomas C. Mann at https://github.com/thomascmann/flatten-data In his words

Python script for flattening nested data into a list of dicts, designed for importing into a pandas DataFrame. The script takes a nested data object and returns a list of dicts. Dicts within the object are flattened, and lists within the object are converted into separate dicts within the returned outer list, copying higher-level elements

Install

On Jupyter Notebooks use

!pip install git+https://github.com/dacog/flatten_data

On normal pip use

pip install git+https://github.com/dacog/flatten_data

Import

from flatten_data import flatten_data as fd

Use

fd.flatten_data(data, simple=0)

simple can have a value of 0 or 1. Check the examples to learn more.

About

flatten data (nested dictionaries and lists) to prepare it for pandas dataframe

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages