DEV Community

Bùi Quang
Bùi Quang

Posted on

CSV Clean X: Robust Python CSV Pipelines

CSV Clean X: A Robust Python Library for CSV Pipelines

When working with data pipelines in Python, cleaning and standardizing CSV data is a common bottleneck. Today, we're introducing CSV Clean X, a lightweight and robust Python library designed to streamline data cleaning, whitespace stripping, missing value handling, and duplicate removal.

Features

  • Whitespace Stripping: Automatically cleans leading and trailing whitespaces from string fields.
  • Missing Value Handling: Option to drop rows with missing or empty values.
  • Duplicate Removal: Ensures unique dataset rows effortlessly.
  • Lightweight & Fast: Zero heavy dependencies, pure Python implementation with robust unit testing.

Installation & Usage

You can find the project repository on GitHub: qtnt2xxx-wq/csv-clean-x.

from csv_clean_x.pipeline import CsvCleanPipeline

data = [
    {"name": " Alice ", "age": "30"},
    {"name": "Bob", "age": "25"},
    {"name": " Alice ", "age": "30"}
]

pipeline = CsvCleanPipeline(data)
cleaned_data = pipeline.run(strip=True, drop_missing=False)
print(cleaned_data)
Enter fullscreen mode Exit fullscreen mode

Check out the repo and contribute!

Top comments (0)