Advanced data cleaning built on top of Pandas
Project description
BambooChute: Advanced Data Cleaning for Pandas
BambooChute is a Python package built on top of Pandas to streamline and simplify advanced data cleaning processes. It offers a rich set of tools for handling missing data, outliers, categorical transformations, date manipulations, and more. With Bamboo, you can perform common and complex data cleaning tasks more efficiently, with an easy-to-use, extensible API.
Table of Contents
Features
- Missing Data Handling: Imputation using strategies like mean, median, KNN, and more.
- Outlier Detection & Removal: Z-Score, IQR, Isolation Forest, and others.
- Date Handling: Conversion, extraction, range creation, and more.
- Categorical Data Processing: Encoding, conversion, and handling missing categories.
- Data Validation: Validate missing data, data types, value ranges, and custom validations.
- Pipelines: Save and load cleaning pipelines for reuse.
- Profiling: Generate summary reports on missing data, outliers, distribution, and correlations.
Installation
Install BambooChute via pip:
pip install BambooChute
Make sure you have Python 3.6+ and the dependencies in requirements.txt are installed:
pip install -r requirements.txt
Getting Started
Here’s a quick example to get you started:
import pandas as pd
from BambooChute import Bamboo
# Load data
data = pd.read_csv('example.csv')
# Initialize Bamboo
bamboo = Bamboo(data)
# Preview the first few rows
print(bamboo.preview_data())
# Handle missing data
bamboo.impute_missing(strategy='mean')
# Detect and remove outliers using Z-Score method
bamboo.detect_outliers_zscore(threshold=3)
# Export cleaned data
bamboo.export_data('cleaned_data.csv')
Usage
Loading Data
Bamboo supports loading data from various formats, including CSV, Excel, JSON, and Pandas DataFrames:
bamboo = Bamboo('data.csv') # Load from CSV
bamboo = Bamboo(df) # Load directly from DataFrame
Handling Missing Data
Impute missing values using different strategies:
bamboo.impute_missing(strategy='mean')
bamboo.impute_knn(n_neighbors=5)
bamboo.drop_missing(axis=0, how='any')
Outlier Detection
Detect outliers using various methods:
# Detect outliers with Z-Score method
outliers = bamboo.detect_outliers_zscore(threshold=3)
# Remove outliers
bamboo.remove_outliers(method='zscore')
Categorical Data
Handle categorical columns easily:
# Convert to categorical
bamboo.convert_to_categorical()
# One-hot encode categorical columns
bamboo.encode_categorical(method='onehot')
Date Manipulations
Perform complex date manipulations with ease:
# Convert columns to datetime
bamboo.convert_to_datetime(['date_column'])
# Extract year, month, day from a date column
bamboo.extract_date_parts('date_column', parts=['year', 'month'])
Data Validation
Validate your dataset before and after cleaning:
# Validate that no missing data exists
is_valid = bamboo.validate_missing_data()
# Validate data types
expected_types = {'age': 'int64', 'name': 'object'}
bamboo.validate_data_types(expected_types)
Testing
The package comes with a set of unit tests under the tests directory. You can run the tests using:
python -m unittest discover tests
Contributing
Contributions are welcome. Please open an issue or submit a pull request if you have suggestions.
Steps to Contribute:
- Fork the repository.
- Create a new branch.
- Make your changes.
- Submit a pull request.
License
Bamboo is licensed under the MIT License. See the LICENSE file for details.
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 BambooChute-1.0.2.tar.gz.
File metadata
- Download URL: BambooChute-1.0.2.tar.gz
- Upload date:
- Size: 26.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfe740a9946f042a63115788dc5c1c7bf9390490bc36d6f886f48a1c9513484a
|
|
| MD5 |
d6657568b78affd4668bad414381cd98
|
|
| BLAKE2b-256 |
74bc44b8b1ce7304876add15bce2013f19c7f55242d7001694d390e0176f29b0
|
File details
Details for the file BambooChute-1.0.2-py3-none-any.whl.
File metadata
- Download URL: BambooChute-1.0.2-py3-none-any.whl
- Upload date:
- Size: 23.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4400836b8e31952cd5ebf55262e354a18b0a797d3eb5600509eabb5326176190
|
|
| MD5 |
fc3ddb0490fb0ad3ce0076e17c54a24d
|
|
| BLAKE2b-256 |
b374c3eaea3e4a00291be40d6c599364f3fdda736d5a9d9766920b57d8145b9d
|