Skip to main content

pdprpr

PanDas PRePRocessor: Preprocess Pandas Objects for Machine Learning

Installation

$ pip install pdprpr

Usage

Assume you have following DataFrame to be preprocessed:

from pandas import DataFrame

df = DataFrame({
    'num': [1, 3, float('nan')],  # numerical feature, needs to be scaled in [0, 1]
    'cat': ['p', 'q', 'r'],       # categorical feature, needs to be transformted to dummy var
    'bin': [False, False, True],  # binary feature, needs to be 0 / 1
}, columns =['num', 'cat', 'bin'])
#    num cat    bin
# 0  1.0   p  False
# 1  3.0   q  False
# 2  NaN   r   True

Define preprocessing settings:

# preprocessing.yml
- name: num
  kind: numerical

- name: cat
  kind: categorical

- name: bin
  kind: binary

Then create DataFramePreprocessor with them:

import yaml

with open('preprocessing.yml') as f:
    settings = yaml.load(f)

from pdprpr import DataFramePreprocessor

processor = DataFramePreprocessor(settings)

Finally use it to preprocess the DataFrame:

processor.process(df)
#    num__VALUE  cat__p  cat__q  cat__r  bin__TRUE
# 0         0.0       1       0       0          0
# 1         1.0       0       1       0          0
# 2         NaN       0       0       1          1

Documentation

For more options please see tests untill docs get available…

Metadata

Release files for pdprpr 0.7.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pdprpr 0.7.2
File Size Uploaded Provenance Actions
pdprpr-0.7.2.tar.gz 4.4 kB Without provenance Details for pdprpr-0.7.2.tar.gz

Release files / pdprpr-0.7.2.tar.gz

Download URL pdprpr-0.7.2.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7dba079b32a14fc34463b214eb9304f77880861158029134517aece6ef96a3d6
BLAKE2b-256 checksum
How to use checksums
8aaa459bbb4d412e80a9a7a5f359f2c219cf69f4bc64427db16453649a141d10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pdprpr 0.7.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page