Skip to main content

Modular, professional Python library for tabular data preprocessing with auto ML-ready pipelines.

Project description

๐Ÿš€ Preplify

The Last Preprocessing Library You'll Ever Need

Preprocess any tabular dataset in one line โ€” clean, encode, scale, engineer, and ML-ready.

Python License Version sklearn

# From messy raw data to ML-ready in ONE line
df_clean = auto_prep(df)

๐Ÿ“Œ What is Preplify?

Preplify is a modular, professional Python library for tabular data preprocessing. Whether you're a beginner who wants everything handled automatically, or an advanced user who wants full control over every step โ€” Preplify has you covered.

No more writing 100 lines of boilerplate preprocessing code. Preplify does it all.


โœจ Features at a Glance

Module What it does
๐Ÿงน Cleaning Remove duplicates, empty rows, fix column names
โ“ Missing Values Mean / Median / Mode / Drop / Constant strategies
๐Ÿ“Š Outlier Removal IQR and Z-score based detection
๐Ÿ”  Encoding One-Hot and Label encoding
๐Ÿ“ Scaling Standard, Min-Max, Robust scaling
๐Ÿ”„ Transformation Log and Power transforms
โš™๏ธ Feature Engineering Interaction, Ratio, and DateTime features
๐ŸŽฏ Feature Selection Correlation filter, Variance filter, Importance selector
๐Ÿ“‰ Dimensionality Reduction PCA
๐Ÿ” Profiling Full data report + summary stats
๐Ÿ’ก Recommender Auto-suggests best preprocessing steps
๐Ÿค– AutoML Preprocess + train baseline model in one call
๐Ÿ”ง Pipeline Custom modular pipeline with full control

โšก Installation

pip install preplify

Requirements:

pip install pandas numpy scikit-learn

Python 3.8+ required


๐Ÿš€ Quick Start

One-Line Preprocessing

import pandas as pd
from preplify import auto_prep

df = pd.read_csv("your_dataset.csv")
df_clean = auto_prep(df)
print(df_clean.shape)

See What Your Data Needs First

from preplify import recommend_preprocessing, data_report

_ = recommend_preprocessing(df)   # get smart suggestions
_ = data_report(df)                # full data overview

Train a Baseline Model Instantly

from preplify import automl_prep

X, model, score = automl_prep(df, target="Survived", task="classification")
print(f"Accuracy: {score:.4f}")

๐Ÿ”ง Full API Reference

๐Ÿ“ฆ Load Demo Data

from preplify.datasets.demo_datasets import (
    load_sample_classification,   # fake classification dataset
    load_sample_regression,       # fake regression dataset
    load_titanic                  # real Titanic CSV (needs internet)
)

df = load_sample_classification()
df = load_sample_regression()
df = load_titanic()

๐Ÿ” Profiling

from preplify import data_report, recommend_preprocessing

_ = data_report(df)             # shape, missing, dtypes, duplicates
_ = recommend_preprocessing(df) # smart preprocessing suggestions

๐Ÿงน Cleaning

from preplify import remove_duplicates, remove_empty_rows, standardize_columns

df = standardize_columns(df)   # "First Name" โ†’ "first_name"
df = remove_duplicates(df)     # drop repeated rows
df = remove_empty_rows(df)     # drop fully empty rows

โ“ Missing Values

from preplify import handle_missing

df = handle_missing(df, strategy="mean")                    # fill with average
df = handle_missing(df, strategy="median")                  # fill with middle value
df = handle_missing(df, strategy="mode")                    # fill with most frequent
df = handle_missing(df, strategy="drop")                    # drop rows with missing
df = handle_missing(df, strategy="constant", fill_value=0)  # fill with 0

๐Ÿ“Š Outlier Removal

from preplify import remove_outliers, remove_outliers_iqr, remove_outliers_zscore

df = remove_outliers(df, method="iqr")          # IQR method (recommended)
df = remove_outliers(df, method="zscore")       # Z-score method
df = remove_outliers_iqr(df)                    # direct IQR
df = remove_outliers_zscore(df, threshold=3)    # direct Z-score

๐Ÿ”  Encoding

from preplify import encode_features, onehot_encode, label_encode

df = encode_features(df, method="onehot")   # "Male/Female" โ†’ 2 columns
df = encode_features(df, method="label")    # "Male/Female" โ†’ 0/1
df = onehot_encode(df)                      # direct one-hot
df = label_encode(df)                       # direct label encoding

๐Ÿ“ Scaling

from preplify import scale_features, minmax_scale, robust_scale

df = scale_features(df, method="standard")  # mean=0, std=1
df = scale_features(df, method="minmax")    # values between 0 and 1
df = scale_features(df, method="robust")    # outlier-resistant scaling
df = minmax_scale(df)                       # shortcut minmax
df = robust_scale(df)                       # shortcut robust

๐Ÿ”„ Transformation

from preplify import log_transform, power_transform

df = log_transform(df)                           # log1p โ€” fix skewed data
df = power_transform(df, method="yeo-johnson")   # works with negatives too
df = power_transform(df, method="box-cox")       # positive values only

โš™๏ธ Feature Engineering

from preplify import (
    auto_feature_engineering,
    interaction_features,
    ratio_features,
    extract_date_features
)

df = auto_feature_engineering(df)                      # auto interaction + ratio
df = interaction_features(df)                          # age * income โ†’ age_x_income
df = ratio_features(df)                                # income / age โ†’ income_ratio_age
df = extract_date_features(df, date_columns=["date"])  # year, month, day, weekday, is_weekend

๐ŸŽฏ Feature Selection

from preplify import correlation_filter, variance_filter, importance_selector

df = correlation_filter(df, threshold=0.9)  # drop columns that are 90%+ similar
df = variance_filter(df, threshold=0.01)    # drop near-constant columns
X  = importance_selector(X, y, top_n=10)   # keep top 10 by Random Forest importance

๐Ÿ“‰ Dimensionality Reduction

from preplify import apply_pca

df = apply_pca(df, n_components=0.95)   # keep 95% of variance
df = apply_pca(df, n_components=3)      # reduce to exactly 3 components

โœ‚๏ธ Train-Test Split

from preplify import split_dataset

X_train, X_test, y_train, y_test = split_dataset(X, y, test_size=0.2)

๐Ÿ”ง Custom Pipeline

Full control over every single step:

from preplify import PreplifyPipeline

pipe = PreplifyPipeline(
    missing_strategy="median",     # mean / median / mode / drop / constant
    encoding="onehot",             # onehot / label
    scaling="robust",              # standard / minmax / robust
    outlier_method="iqr",          # iqr / zscore / None
    feature_engineering=True       # True / False
)

df_clean = pipe.fit_transform(df)

๐Ÿค– AutoML โ€” Preprocess + Train in One Call

from preplify import automl_prep

# Classification
X, model, score = automl_prep(df, target="Survived", task="classification")
print(f"Accuracy: {score:.4f}")

# Regression
X, model, score = automl_prep(df, target="Price", task="regression")
print(f"Rยฒ Score: {score:.4f}")
Task Model Used Score Metric
classification Logistic Regression Accuracy
regression Ridge Regression Rยฒ Score

๐ŸŒ Real Dataset Example (Titanic)

import pandas as pd
from preplify import auto_prep, recommend_preprocessing
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score

# Load
df = pd.read_csv("titanic.csv")

# Explore
_ = recommend_preprocessing(df)

# Preprocess
target = df["Survived"]
df_clean = auto_prep(df.drop(columns=["Survived"]))

# Train Random Forest
X_train, X_test, y_train, y_test = train_test_split(df_clean, target, test_size=0.2, random_state=42)
model = RandomForestClassifier()
model.fit(X_train, y_train)
print(f"Accuracy: {accuracy_score(y_test, model.predict(X_test)):.4f}")

๐Ÿ—‚๏ธ Project Structure

preplify/
โ”‚
โ”œโ”€โ”€ preplify/
โ”‚   โ”œโ”€โ”€ core/              # Pipeline, auto_prep, automl_prep
โ”‚   โ”œโ”€โ”€ cleaning/          # Duplicates, empty rows, column names
โ”‚   โ”œโ”€โ”€ missing/           # Missing value strategies
โ”‚   โ”œโ”€โ”€ outliers/          # IQR and Z-score detection
โ”‚   โ”œโ”€โ”€ encoding/          # One-hot and label encoding
โ”‚   โ”œโ”€โ”€ scaling/           # Standard, MinMax, Robust
โ”‚   โ”œโ”€โ”€ transformation/    # Log and Power transforms
โ”‚   โ”œโ”€โ”€ feature_engineering/  # Interaction, ratio, date features
โ”‚   โ”œโ”€โ”€ feature_selection/ # Correlation, variance, importance
โ”‚   โ”œโ”€โ”€ reduction/         # PCA
โ”‚   โ”œโ”€โ”€ split/             # Train-test split
โ”‚   โ”œโ”€โ”€ profiling/         # Data report, summary stats
โ”‚   โ”œโ”€โ”€ recommender/       # Preprocessing recommendations
โ”‚   โ”œโ”€โ”€ datasets/          # Demo datasets
โ”‚   โ””โ”€โ”€ utils/             # Validators, logging, helpers
โ”‚
โ”œโ”€โ”€ examples/              # Ready-to-run example scripts
โ”œโ”€โ”€ tests/                 # Unit tests
โ”œโ”€โ”€ docs/                  # Documentation
โ”œโ”€โ”€ setup.py
โ””โ”€โ”€ README.md

๐Ÿ”• Disable Logs

By default Preplify logs every step. To turn off:

import logging
logging.getLogger("preplify").setLevel(logging.WARNING)

๐Ÿงช Run Tests

pip install pytest
pytest tests/

๐Ÿ“„ License

MIT License โ€” free to use, modify, and distribute.


๐Ÿ‘จโ€๐Ÿ’ป Author

Muhammad Hussnain


If Preplify saved you time, give it a โญ 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

preplify-1.0.3.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

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

preplify-1.0.3-py3-none-any.whl (32.2 kB view details)

Uploaded Python 3

File details

Details for the file preplify-1.0.3.tar.gz.

File metadata

  • Download URL: preplify-1.0.3.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for preplify-1.0.3.tar.gz
Algorithm Hash digest
SHA256 cf3eb7b356b6804b6276f7ac567c59ffac0ba5ec314002f2d30b7bf511e8cda4
MD5 b10571652f51eb070782762612a0fe42
BLAKE2b-256 9f6623655ec7e7a78eb1c26cddf5f5d452c70550e4c9f596717d59b73111a755

See more details on using hashes here.

File details

Details for the file preplify-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: preplify-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 32.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for preplify-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a6c2b90bcae9b73b058a74b80ce57deeabb6d2c65c084fe5d00e8ca988bc22e6
MD5 e955d029aca543588b6e2ecc13848521
BLAKE2b-256 1295149203611ccc9d248a11ca52783040730c61fff13fee7996c46f9fec08ce

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