Skip to main content

No project description provided

Project description

dataflat

A library to flatten all this annoiyng nested keys and columns on Dictionaries, Pandas Dataframes and Spark (pyspark) Dataframes.

Installation

pip install dataflat

Get started

How to instantiate a Flattener:

from dataflat.flattener_handler import Options, Flattener

id_key = 'id'
black_list = ['keys','or','columns','to','skip']

#The following variables have the default values for each transform function
to_snake_case = False
replace_dots = False
dict_name = 'dct'
chunk_size = 500
dataframe_name = 'df'

# Instantiate a Dictionary Flattener
flattener_dict = Flattener().handler(Options.DICTIONARY)
flattener.transform(dictionary, id_key, black_list, dict_name, to_snake_case, replace_dots)


# Instantiate a Pandas Dataframe Flattener
flattener_pd = Flattener().handler(Options.PANDAS_DF)
transform(dataframe, id_key, black_list, dataframe_name, chunk_size, to_snake_case, replace_dots)

# Instantiate a Spark Dataframe Flattener
flattener_sp = Flattener().handler(Options.SPARK_DF)
transform(dataframe, id_key, black_list, dataframe_name, to_snake_case, replace_dots)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dataflat-1.0.1.tar.gz (11.9 kB view hashes)

Uploaded Source

Built Distribution

dataflat-1.0.1-py3-none-any.whl (16.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page