A practice project combining NumPy, Pandas, Matplotlib, and Seaborn for learning and revision.
Project description
🧹 DataCleaner
A simple and flexible Python utility for data cleaning and preprocessing.
It helps you handle missing values, remove duplicates, treat outliers, reduce features, and encode categorical data — all in one place.
✨ Features
- Missing Values Handling
- Drop, Mean, Median, Mode, KNN Imputation
- Remove Duplicates
- Outlier Detection & Removal
- IQR, Z-score, Isolation Forest
- Feature Reduction
- Low variance feature removal
- High correlation feature removal
- Encoding Categorical Data
- Label Encoding
- One-Hot Encoding
- Frequency Encoding
- Auto Encoding (chooses based on cardinality)
- Report Generation – keeps track of all cleaning steps applied
📦 Installation
Clone the repo:
git clone https://github.com/ck-ahmad/datacleaner.git
Install dependencies:
pip install -r requirements.txt
🚀 Usage Example
import pandas as pd
from cleaner import DataCleaner
# Sample dataset
df = pd.DataFrame({
"Name": ["Ali", "Sara", "John", "Ali", None],
"Age": [25, None, 30, 25, 22],
"Salary": [50000, 60000, None, 50000, 45000],
"City": ["Lahore", "Karachi", "Karachi", "Lahore", "Islamabad"]
})
# Initialize cleaner
cleaner = DataCleaner(df)
# Apply cleaning steps
cleaned_df = (
cleaner
.handle_missing(strategy="mean") # fill missing values
.remove_duplicates() # remove duplicate rows
.handle_outliers(method="iqr") # handle outliers
.remove_low_variance(threshold=0.01)
.remove_high_correlation(corr_threshold=0.9)
.encode(method="auto") # encode categorical columns
.get_data()
)
# Get report of cleaning steps
report = cleaner.get_report()
print("✅ Cleaned Data:")
print(cleaned_df)
print("\n📝 Cleaning Report:")
print(report)
📋 Example Output
Cleaned Data
Copy code
Age Salary City_Karachi City_Lahore City_Islamabad
0 25 50000.0 0 1 0
1 25 50000.0 1 0 0
2 22 45000.0 0 0 1
Cleaning Report
Step Action
1 Filled missing Age with mean
2 Filled missing Salary with mean
3 Dropped rows with missing in Name
4 Removed 1 duplicate rows
5 Removed outliers in Age using IQR
6 Applied Auto Encoding
🛠️ Requirements
pandas numpy scikit-learn
Copy code
pip install pandas numpy scikit-learn
📖 License
This project is licensed under the MIT License – feel free to use and Open To Collabrate For Contibutions in it.
👨💻 Author
Ahmad Abdullah 🌐 LinkedIn: linkedin.com/in/ahmad0763 💻 GitHub: github.com/ck-ahmad
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 datacleaner_ck-1.1.1.tar.gz.
File metadata
- Download URL: datacleaner_ck-1.1.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7e5d348e52dcab4a549eada39eef3f579d6ebeb04c3c24ab887bb0f55e4e7ee
|
|
| MD5 |
04ea6afdb3256a5c2b7ae2ad07a8a557
|
|
| BLAKE2b-256 |
407a733a232f6ab3667d40e9411ecb8cf7bcb52611ceb28cb24e664553d8fcb3
|
File details
Details for the file datacleaner_ck-1.1.1-py3-none-any.whl.
File metadata
- Download URL: datacleaner_ck-1.1.1-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f64ab4ba74cc2f08af6ed9a2dbcfd873e7d0129469fa330d9e65ad71a7017623
|
|
| MD5 |
3e415b23db06cc26491e9fd1371a29ee
|
|
| BLAKE2b-256 |
3c177c08104669d50bbc5279e97126ec4b06326f4c12657c1340abb6264fa225
|