Skip to main content

A Python package combining essential preprocessing tools

Project description

PreProPy

A Python package combining three essential preprocessing tools: NullSense, DupliChecker, and ScaleNPipe.

Installation

pip install prepropy

Features

PreProPy provides three core components:

1. NullSense

Intelligently handle missing values in your data based on column types:

import pandas as pd
from prepropy import handle_nulls

# Create a sample dataframe with missing values
df = pd.DataFrame({
    'numeric': [1, 2, None, 4, 5],
    'categorical': ['A', 'B', None, 'B', 'C']
})

# Fill missing values with intelligent defaults
df_filled = handle_nulls(df, strategy="auto")
# Numeric columns filled with median, categorical with mode

# Other available strategies
df_mean = handle_nulls(df, strategy="mean")  # Fill numeric with mean
df_median = handle_nulls(df, strategy="median")  # Fill numeric with median
df_mode = handle_nulls(df, strategy="mode")  # Fill all columns with mode
df_zero = handle_nulls(df, strategy="zero")  # Fill numeric with 0, categorical with ""

2. DupliChecker

Identify and remove duplicate records with configurable options:

import pandas as pd
from prepropy import drop_duplicates, get_duplicate_stats

# Create a sample dataframe with duplicates
df = pd.DataFrame({
    'A': [1, 2, 2, 3, 3],
    'B': ['x', 'y', 'y', 'z', 'z']
})

# Get duplicate statistics
stats = get_duplicate_stats(df)
print(stats)
# Output: {'duplicate_count': 2, 'duplicate_percent': 40.0, 'unique_count': 3, 'total_count': 5}

# Drop duplicates (keeping first occurrence)
df_unique = drop_duplicates(df)

# Drop duplicates based on specific columns
df_unique_subset = drop_duplicates(df, subset=['B'])

# Keep the last occurrence instead of first
df_unique_last = drop_duplicates(df, keep='last')

# Drop all duplicates
df_no_dups = drop_duplicates(df, keep=False)

3. ScaleNPipe

Create scikit-learn pipelines with feature scaling and your model:

from sklearn.linear_model import LogisticRegression
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from prepropy import scale_pipeline, get_available_scalers

# Load sample data
X, y = load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)

# Create a model
model = LogisticRegression()

# Create a pipeline with standard scaling
pipeline = scale_pipeline(model, scaler="standard")

# Train the pipeline
pipeline.fit(X_train, y_train)

# Make predictions
predictions = pipeline.predict(X_test)

# See available scalers
scalers = get_available_scalers()
print(scalers)

Requirements

  • pandas >= 1.0.0
  • scikit-learn >= 0.24.0

License

MIT


Made with ❤️ by the PreProPy Team

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

prepropy-0.1.0.tar.gz (19.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prepropy-0.1.0-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file prepropy-0.1.0.tar.gz.

File metadata

  • Download URL: prepropy-0.1.0.tar.gz
  • Upload date:
  • Size: 19.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for prepropy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 52f9c477aa3b26586cf75a2140536777554099241d97d983a1d20d7d78ebfe73
MD5 146a41919ae29c0bdff902cf63e2a770
BLAKE2b-256 3701e26cdbcca25bd7d2631f50aaae683973f5615fce719c8e748eff60d70ea9

See more details on using hashes here.

File details

Details for the file prepropy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: prepropy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for prepropy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0d4bf5103b1b31dcce0f374d31cadcbbbbbaabab6972a454bc0f692118801025
MD5 509995210263b2797e1741baf045cb25
BLAKE2b-256 c8575249bf7dcc6b37c865a3a1a1dad272155725c93fbce9b5d8c0092ce51e18

See more details on using hashes here.

Supported by

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