Metadata-Version: 2.4
Name: pandas-auto-prep
Version: 0.1.0
Summary: A pandas accessor that automates 80-90% of standard tabular data preprocessing tasks
Author: Aarush Gupta
License: MIT
Project-URL: Homepage, https://github.com/aarushgupta/pandas-auto-prep
Project-URL: Repository, https://github.com/aarushgupta/pandas-auto-prep
Project-URL: Issues, https://github.com/aarushgupta/pandas-auto-prep/issues
Keywords: pandas,preprocessing,data-science,machine-learning,data-cleaning,feature-engineering,automation
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas>=1.3.0
Requires-Dist: numpy>=1.20.0
Requires-Dist: scikit-learn>=1.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: isort>=5.12.0; extra == "dev"
Dynamic: license-file

# Pandas Auto Prep

[![PyPI version](https://badge.fury.io/py/pandas-auto-prep.svg)](https://pypi.org/project/pandas-auto-prep/)
[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A powerful pandas accessor that automates **80-90% of standard tabular data preprocessing tasks** with a single command.

## Installation

```bash
pip install pandas-auto-prep
```

## Quick Start

```python
import pandas as pd
import pandas_auto_prep  # This registers the .prep accessor

# Load your data
df = pd.read_csv("your_data.csv")

# Preprocess with one line!
X_train, X_test, y_train, y_test = df.prep.auto(target='target_column')
```

## Features

The `.prep.auto()` method performs the following preprocessing steps automatically:

| Step | Task | Details |
|------|------|---------|
| 1 | **Housekeeping** | Remove duplicates, constant columns, high-missing columns (>50%) |
| 2 | **Datetime Handling** | Extract Year, Month, Day, DayOfWeek from datetime columns |
| 3 | **Missing Value Imputation** | Median for numeric, Mode for categorical |
| 4 | **Skewness Handling** | Log(x+1) transformation for highly skewed columns |
| 5 | **Outlier Handling** | Winsorization (clip to 1st-99th percentiles) |
| 6 | **Categorical Encoding** | One-Hot for low cardinality, Label Encoding for high cardinality |
| 7 | **Scaling** | StandardScaler for all numeric features |
| 8 | **Train/Test Split** | Stratified split (configurable) |

## Parameters

```python
df.prep.auto(
    target='target_column',      # Target column name (optional)
    test_size=0.2,               # Test split ratio
    random_state=42,             # Random seed
    cardinality_thresh=10,       # One-Hot vs Label Encoding threshold
    missing_thresh=0.5,          # Drop columns with >50% missing
    skewness_thresh=1.0,         # Skewness threshold for log transform
    verbose=True                 # Print progress
)
```

## Usage Examples

### With Target (Supervised Learning)

```python
import pandas as pd
import pandas_auto_prep

df = pd.read_csv("customer_churn.csv")
X_train, X_test, y_train, y_test = df.prep.auto(target='churn')

# Ready for model training!
from sklearn.ensemble import RandomForestClassifier
model = RandomForestClassifier()
model.fit(X_train, y_train)
```

### Without Target (Data Cleaning Only)

```python
import pandas as pd
import pandas_auto_prep

df = pd.read_csv("messy_data.csv")
clean_df = df.prep.auto()  # Returns fully preprocessed DataFrame
```

### Access Fitted Objects

```python
# After running .prep.auto()
label_encoders = df.prep.get_label_encoders()  # For inverse transforms
scaler = df.prep.get_scaler()                   # Fitted StandardScaler
```

## Requirements

- Python >= 3.8
- pandas >= 1.3.0
- numpy >= 1.20.0
- scikit-learn >= 1.0.0

## License

MIT License - see [LICENSE](LICENSE) for details.

## Author

**Aarush Gupta**
