Advanced data imputation library
Project description
advprep: Advanced Data Preprocessing Toolkit
advprep is a Python package providing advanced tools for data preprocessing, including imputation, encoding, scaling, feature engineering, and an easy-to-use preprocessing pipeline. It helps you clean and prepare your datasets efficiently for machine learning or analysis.
Installation
Make sure you have these dependencies installed:
pip install pandas numpy scikit-learn category_encoders
Then, include the advprep package files in your project folder or install it as a local package.
Modules and Usage
1. Imputation (imputation.py)
Handle missing data with different strategies like mean, median, mode, forward-fill, backward-fill, KNN, and iterative imputation.
from advprep.imputation import AdvancedImputer
import pandas as pd
df = pd.read_csv("data.csv")
imputer = AdvancedImputer(method="knn", knn_neighbors=3)
df_imputed = imputer.fit_transform(df)
2. Encoding (encoding.py)
Encode categorical features using One-Hot, Ordinal, or Target encoding.
from advprep.encoding import AdvancedEncoder
encoder = AdvancedEncoder(method="onehot")
df_encoded = encoder.fit_transform(df, columns=["CategoryCol1", "CategoryCol2"])
For target encoding:
encoder = AdvancedEncoder(method="target")
df_encoded = encoder.fit_transform(df, columns=["CategoryCol"], target="TargetColumn")
3. Scaling (scaling.py)
Scale numerical features using StandardScaler, MinMaxScaler, RobustScaler, or PowerTransformer.
from advprep.scaling import AdvancedScaler
scaler = AdvancedScaler(method="minmax")
df_scaled = scaler.fit_transform(df)
4. Feature Engineering (feature_engineering.py)
Create new features like date parts or polynomial features.
Extract date/time features:
from advprep.feature_engineering import FeatureEngineer
df_features = FeatureEngineer.extract_date_features(df, date_column="OrderDate")
Generate polynomial features:
df_poly = FeatureEngineer.generate_polynomial_features(df, columns=["Feature1", "Feature2"], degree=3)
5. Pipeline (pipeline.py)
Combine multiple preprocessing steps into a single pipeline for easy and repeatable workflows.
from advprep.imputation import AdvancedImputer
from advprep.encoding import AdvancedEncoder
from advprep.scaling import AdvancedScaler
from advprep.pipeline import PreprocessingPipeline
pipeline = PreprocessingPipeline(steps=[
AdvancedImputer(method="median"),
AdvancedEncoder(method="onehot"),
AdvancedScaler(method="standard")
])
df_processed = pipeline.fit_transform(df)
Notes
- For target encoding, always provide the target column name when fitting.
- Date columns must be parseable by
pd.to_datetimefor date feature extraction. - By default, most methods operate on all suitable columns (numeric for imputation/scaling, categorical for encoding). You can specify
columnsto limit processing. - The pipeline applies the steps sequentially to the DataFrame.
- The iterative imputer uses Bayesian Ridge by default and requires scikit-learn version supporting it.
category_encodersis required
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
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 advprep-0.1.2.tar.gz.
File metadata
- Download URL: advprep-0.1.2.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a538b95f5d40fbbed7f1988672036e12467c94ddc7210a27dc46d80a909e1d2
|
|
| MD5 |
06406f27587a3c1651f92a45d564dd4f
|
|
| BLAKE2b-256 |
8fb2ee234e5440f9b0f8ec559e27f5b1f5bb66102751b899fdd84fc12c638b0e
|
File details
Details for the file advprep-0.1.2-py3-none-any.whl.
File metadata
- Download URL: advprep-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e61cf8083ee827aaf5b35e0db20d7daa8a80aab6638ca27b2d730b954441204
|
|
| MD5 |
8c975622ecb58841512d837225a085da
|
|
| BLAKE2b-256 |
0309b76753ebef5df82c7821b165be9ffa0da12f5117d87d99f93cb15c875c28
|