Data Cleaning & Format Conversion Utility

Python · Pandas · OpenPyXL · PyArrow · CLI Tooling

A supporting utility created to reduce repetitive preparation while working on customer churn, product drop-off and other data-analysis projects.

Why I Built It

A practical response to a repeated workflow problem.

Many datasets I used from Kaggle arrived as CSV files. Python and Pandas were useful for cleaning and analysis, but I sometimes wanted to continue in Excel using PivotTables, charts and spreadsheet exploration.

Instead of manually cleaning and converting every dataset, I separated the workflow into two focused scripts: one for cleaning and one for format conversion.

Workflow

The utility supports analysis rather than replacing it.

Kaggle or other raw dataset
        ↓
clean_data.py
        ↓
Cleaned dataset + transformation log
        ↓
convert_data.py --to csv|xlsx|parquet
        ↓
Python, Excel, PivotTables or downstream analysis

Cleaning Behaviour

Selectable rules for common data-quality problems.

Standard Profile

  • Trims whitespace without turning true missing values into text
  • Converts blank strings to missing values
  • Removes duplicates
  • Uses medians for missing numeric values
  • Uses modes or N/A for missing text values

Aggressive Profile

  • Removes fully empty rows
  • Removes duplicates
  • Fills missing numeric values with zero
  • Fills missing text values with N/A
  • Creates a human-readable cleaning log

Runtime Format Conversion

One converter controls the direction through command-line parameters.

python convert_data.py customers.csv --to xlsx
python convert_data.py customers.csv --to parquet
python convert_data.py customers.parquet --to xlsx
python convert_data.py report.xlsx --to csv --sheet "Customer Data"
python convert_data.py report.xlsx --to parquet --all-sheets

The converter includes:

  • Automatic input-format detection
  • CSV, Excel and Parquet inputs and outputs
  • Excel worksheet selection and all-sheet export
  • Automatic output naming or a custom output path
  • Overwrite protection unless explicitly enabled
  • Validation for missing files and unsupported formats

Design Decisions

Separate Responsibilities

clean_data.py handles data-quality rules. convert_data.py handles representation and file-format changes.

Safe Defaults

Existing files are not silently replaced, Excel workbooks with multiple sheets require an explicit choice, and invalid file extensions produce clear errors.

Format Awareness

CSV is treated as plain tabular data, Excel as a stakeholder-friendly analysis format, and Parquet as an efficient typed analytical format.

Real Workflow Context

The utility was created because the same preparation steps appeared repeatedly across actual analyses, not as an isolated demonstration.

Technologies

PythonPandasOpenPyXLPyArrow CSVExcelParquetCLI
Back to Projects