Skip to main content

A lightweight, modular Python library for data cleaning workflows.

Project description

CleaningBox

A unified interface for practical data cleaning.

Python Version PyPI version License

CleaningBox is a lightweight, modular Python library that streamlines data cleaning for structured (tabular) datasets. It provides a simple, readable interface for handling common preprocessing tasks such as missing value imputation, encoding, normalization, and outlier detection — all in one place.

Designed for clarity and flexibility, CleaningBox helps you prepare data efficiently for analysis or machine learning workflows, without unnecessary boilerplate.

Changelog V1.0.3:

Note: Versions 1.0.0 to 1.0.2 were removed due to early development cleanup. This is the first official release.

Features

🔧 Functionality 📄 Description 🎯 Purpose / Output
🔍 Missing Value Detection Scans for missing values, with adjustable feedback verbosity Returns summary, detailed table, or a Boolean (for automation)
🧩 Missing Value Imputation Fills missing values using statistical strategies Uses mean/median/mode based on data skewness and column type
📐 Normalization Scales numeric data using min-max, z-score, or robust Standardizes data for modeling or comparisons
0️⃣1️⃣ Binarization Converts yes/no, or user-specified, values into binary 0/1 format Simplifies categorical values for analysis or ML input
📦 One-Hot Encoding Encodes categorical variables into multiple binary columns Prepares data for ML algorithms that can't handle text categories
🚨 Outlier Detection Detects/flags and/or removes outliers using z-score or IQR Can return, remove, or flag outlier rows
🖥️ Data Preview Displays a clean, tabular printout of the current dataset Prints a readable Pandas DataFrame snapshot
💾 Export Data Saves the current dataset to a selected file extension Useful for sharing or downstream workflows
🔓 Data Access Returns dataset as a standard Pandas DataFrame Allows integration with external tools like Seaborn, Scikit-learn, etc.

Installation

CleaningBox is available on PyPI, so you can install it using pip:

Requires: Python 3.7 or higher

pip install cleaningbox

Installing from Source (for Development)

To install the latest version directly from the repository:

  1. Clone the repository from GitHub
  2. Navigate to the project directory
  3. Install the package in editable mode using pip

Usage

📘 For full in-depth documentation, see the Full Documentation.

Basic Example

from cleaningbox import cleaningbox

cb = cleaningbox()
cb.load_data("office_dataset.csv", missingvalues=["?", "NaN", "None", "/"])
cb.find_missing_values(verbose="true")
# Output
# ⚠️ Missing values detected
# Missing values found: 8 | Affected columns: 3
# Valid/Missing values: 210 / 8 (3.81%)
# 
#       Attribute_Name  Missing_Value_Count  Missing_Value_Percentage
# 0             salary                    3                      10.0
# 1              job                      3                      10.0
# 2  subscribed_newsletter                2                       6.7

cb.imputation()
cb.viewer()
# Output
#        name   age      job   salary  subscribed_newsletter
# 0   Alice    34.0  Manager  55000.0                   Yes
# 1   Bob      45.0  Analyst  62000.0                   No
# ...

Full Cleaning Workflow

# Encode binary column
cb.binarization(columns=["subscribed_newsletter"])

# Normalize data (exclude age)
cb.normalization(method="robust", columns="all", exclude="age")

cb.one_hot_encoding(columns="job", drop_first=True)

# Flag outliers
cb.outlier(method="zscore", action="flag", threshold=3)

# Export cleaned dataset
cb.export_data("cleaned_office_dataset.csv")

🧪 Combine with Pandas or ML libraries

import seaborn as sns

# Retrieve as a native Pandas DataFrame
df = cb.get_data()
sns.boxplot(data=df, x="job_Sales", y="salary")

✅ For a full working demo, see the demo/example.py script.

📘 For full in-depth documentation, see the Full Documentation.

🤝 Contributing

Contributions are welcome! If you'd like to fix a bug, add a feature, or improve documentation:

  1. Fork the repository
  2. Create a new branch
  3. Commit your changes
  4. Push the branch
  5. Open a pull request

Please ensure code style and functionality are consistent with the existing codebase.

📬 Support & Feedback

Have questions, bugs, or suggestions?

  • 🐛 Submit an issue on GitHub
  • 💬 For feature requests or general feedback, feel free to open a discussion or contribute.

👤 Author

Kevin Nochez | GitHub Account

📄 License

This project 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

cleaningbox-1.0.3.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

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

cleaningbox-1.0.3-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file cleaningbox-1.0.3.tar.gz.

File metadata

  • Download URL: cleaningbox-1.0.3.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for cleaningbox-1.0.3.tar.gz
Algorithm Hash digest
SHA256 4f238fea4bc4f3d3ac061b909022cf0a3f977e580191a2340a748a2bce481637
MD5 ad5d683d01064cc90318a1fd9fa3a06c
BLAKE2b-256 1ff70337c442f0f36da7501c1259718fd94bd8958b483dde2b10a7409190b7cf

See more details on using hashes here.

File details

Details for the file cleaningbox-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: cleaningbox-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for cleaningbox-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0c30e85fa693105247fb7de68a3748887fb75a276ae4d411daa7577de7b4daaa
MD5 5be57e60c611a29fa174be45e1a5f7b8
BLAKE2b-256 9144545f6641b1610c7a7897a1a9e61a98f2de8980cc4e56702e4ce7da792351

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