Analysis

Standardize Messy Dataset With Python

List the current messy column names, the target clean names, and your formatting rules for dates, phone numbers, and category mappings. - Generates a runnable pandas script standardizing dates and currency - Splits addresses into street, city, state, and zip - Splits full names into first_name and last_name, formats phone numbers - Ends with a before/after validation summary of row counts and samples

Prompt
Write a Python/pandas script that standardizes this dataset:

Current column names: {messy_columns}
Target column names: {clean_columns}

Standardization rules:
- Dates in {date_format}
- Currency values converted to numeric (strip $, commas, handle parentheses as negatives)
- Phone numbers formatted as {phone_format}
- Addresses split into: street, city, state, zip
- Full names split into first_name and last_name
- All text columns: trim whitespace, fix encoding problems
- Categorical columns: {category_mappings}

Produce a complete, runnable script with comments explaining each step. Add a validation summary at the end printing row counts before and after, plus sample rows.
Download .md

Variables