Fixing

edf.fix() runs a deterministic, configurable cleaning pipeline and returns the cleaned data with an audit trail.

The default pipeline

  1. Normalise column names
  2. Trim leading and trailing whitespace
  3. Recognise configured missing-value markers
  4. Remove exact duplicate rows
  5. Remove empty rows and columns
  6. Fill missing values with the configured strategy

Configuration

Pass a FixConfig to control every cleaning stage. Use a ColumnCleaningRule when one column needs a different strategy.

fixing.py
import eazydatafix as edf

config = edf.FixConfig(
    missing_value_strategy="median",
    missing_markers=("", "NA", "N/A", "unknown"),
    column_rules={
        "department": edf.ColumnCleaningRule(
            missing_value_strategy="mode",
        ),
    },
)

result = edf.fix("employees.csv", config)
print(result.applied_fixes)
result.save("employees-clean.csv")

Dry run

Set dry_run=True to preserve the source in result.dataset and inspect the cleaned proposal separately in result.proposed_dataset.

dry_run.py
config = edf.FixConfig(dry_run=True)
preview = edf.fix("employees.csv", config)

print(preview.dry_run)
print(preview.change_log)
print(preview.proposed_dataset.head())
Python 3.11
>>> preview.dry_run
True
>>> preview.dataset.shape, preview.proposed_dataset.shape
((12, 8), (11, 8))

Exporting

result.save() and the backwards-compatible result.to_csv()write CSV files. For Excel, export the cleaned DataFrame directly.

export_cleaned.py
result.save("employees-clean.csv")
result.dataset.to_excel("employees-clean.xlsx", index=False)

See the reference for the complete return value and usage notes.