Skip to main content

pangoro python package

Project description

Project description

Pangoro: powerful Python data cleaning toolkit

What is it?

Pangoro is a Python package that provides fast and flexible methods for cleaning numerical and categorical features in a dataframe. It aims to be a fundamental tool for doing data wrangling in Python.

Main Features:

  • For numerical features, pangoro provides the following tools:
    • Handle NA, drop, replace with mean, replace with mode, lamda function, replace with a number, replace with min replace with max, Use KNN classifications. Keep
    • Handle outliers, Keep, Percentile
    • Scaling, standard or min max
    • Convert to nuemerical
    • Scan and apply to all numerical or supply a list of features
  • For categorical nominal features, pangoro provides the following tools:
    • Handle NA, Drop, replace with mode, use KNN classification for imputation.
    • Replace with sequence numbers based on supplied dictionary or based on alphabetical order.
    • Scan and apply to all Categorical or supply a list of features

Where to get it:

The source code is currently hosted on GitHub
Binary installers for the latest released version are available at the Python Package Index PyPi

pip install pangoro

Usage

1. Import

Import what you need from the pangoro package. The choices are: PangoroDataFrame, a class for cleaning numerical and categorical features in a dataframe in addition to plotting features correlations.

For this demonstration, we will import:

>>> from pangoro.preprocessing import PangoroDataFrame

For these examples, we'll also use pandas to :

>>> import pandas as pd

2. Load some Data

Typicall data will is read from a tabular formatted file, but for illustration we'll create a simple dataframe from a Python dict:

>>> sample_data = pd.DataFrame({'pet':      ['cat', 'dog', 'dog', pd.NA, 'cat', 'dog', 'cat', 'fish'],
                       'color': ['white', 'brown', 'black', 'gold', pd.NA,'black', 'white', 'silver'],
                       'weight':   [50.5, 22.5, 4, pd.NA , 12, 39, 16, pd.NA]})
>>> sample_data['weight'] = pd.to_numeric(sample_data['weight'])
>>> sample_data.dtypes

3. Create Instance and Apply Transformation

3.1 We will start by creating an instance of PangoroDataFrame using the created sample_data DataFrame above:

>>> pdf = PangoroDataFrame(sample_data)

3.2 Then, we will automate cleaning of numerical features in PangoroDataFrame by replacing NAs with mean and without performing any scaling:

>>> pdf.numerical_transformation(col = ['weight'], na_treat = 'mean', out_treat = True, out_upper = 0.8,
                         out_lower = 0.2, scaling='no', knn_neighbors = 0)

Similarly, as we continue with this example and using pdf as an instance PangoroDataFrame we can apply the other functions to clean and preprocess categorical ordinal by calling pdf.categorical_ordinal_transformation or categorical nominal by calling pdf.categorical_ordinal_transformation

In addition, we can quickly plot correlations between features by calling: pdf.plot_all_correlations

4. Getting Help

To learn more about we can issue the following command:

>>> help(PangoroDataFrame)

As a result we get detailed information about the package and each function included.

License

MIT

Background

Work on pangoro started in 2022 by a group of IE University students and has been under active development since then.

Contributing to pangoro

All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome. Please contact us on GitHub

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

pangoro-0.34.tar.gz (9.8 kB view details)

Uploaded Source

File details

Details for the file pangoro-0.34.tar.gz.

File metadata

  • Download URL: pangoro-0.34.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for pangoro-0.34.tar.gz
Algorithm Hash digest
SHA256 7f1e7ba3fbd1cb5a001fe0a79ecd5e3a5076817915b3e41e96f70c5954bc9961
MD5 07cc2330261108d3a32a120551f07b85
BLAKE2b-256 5d5af8e2e52fcabe28acf06bbb1decee0a3cd5183aaf42f9b4321f422dfd0cc8

See more details on using hashes here.

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