Skip to main content

Advanced data cleaning built on top of Pandas

Project description

Bamboo: Advanced Data Cleaning for Pandas

Bamboo 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 Bamboo via pip:

pip install bamboo-cleaning

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 bamboo 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:

  1. Fork the repository.
  2. Create a new branch.
  3. Make your changes.
  4. Submit a pull request.

License

Bamboo is licensed under the MIT License. See the LICENSE file for details.


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

BambooChute-1.0.1.tar.gz (26.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

BambooChute-1.0.1-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file BambooChute-1.0.1.tar.gz.

File metadata

  • Download URL: BambooChute-1.0.1.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

Hashes for BambooChute-1.0.1.tar.gz
Algorithm Hash digest
SHA256 64d31dfdb4b54a51e9bb380578dc41a0bd1c54219f70e82427722aee2bc4eb40
MD5 2603be74bdf5c863a9cf440acd428ac3
BLAKE2b-256 d0d3ba1486c73308a1737a6d7517e67b62cb59650fa9bb2ba7f9863f80d2ddac

See more details on using hashes here.

File details

Details for the file BambooChute-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: BambooChute-1.0.1-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

Hashes for BambooChute-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d58b0736bfb00b1867afa2426d9d3da26bc29ca47e0c557ae3dc8ff321dca216
MD5 3c2ef6549bd7ca58f0b15e7badcfb33b
BLAKE2b-256 30425b731e559db503f62c8ccb2698867362a6e4428b0f1697e4b84b7daa081d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page