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.
# 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
- ๐ง muhammadhussnain1227@gmail.com
- โญ GitHub Repo
- ๐ GitHub Profile
- ๐ผ LinkedIn Profile
If Preplify saved you time, give it a โญ on GitHub!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf3eb7b356b6804b6276f7ac567c59ffac0ba5ec314002f2d30b7bf511e8cda4
|
|
| MD5 |
b10571652f51eb070782762612a0fe42
|
|
| BLAKE2b-256 |
9f6623655ec7e7a78eb1c26cddf5f5d452c70550e4c9f596717d59b73111a755
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6c2b90bcae9b73b058a74b80ce57deeabb6d2c65c084fe5d00e8ca988bc22e6
|
|
| MD5 |
e955d029aca543588b6e2ecc13848521
|
|
| BLAKE2b-256 |
1295149203611ccc9d248a11ca52783040730c61fff13fee7996c46f9fec08ce
|