Back to guide/Research & Analysis

Data Cleaning Script

Requiring before/after logging and a summary report turns a cleaning script into an auditable process. Flagging rows for manual review prevents silent data loss.

chatgpt-prompts-for-data-analysislanguagecolumn_definitionsrow_count
Edit View
Prompt
Write a {{language}} script to clean this dataset. Here is the structure:

Columns: {{column_definitions}}
Row count: approximately {{row_count}}
Known issues:
{{data_issues}}

For each issue, implement a cleaning step that:
1. Logs how many rows are affected before the fix
2. Applies the transformation
3. Validates the result

After cleaning, generate a summary report showing:
- Rows before/after
- Columns modified
- Values imputed or removed
- Any rows flagged for manual review

Use {{library}} for data manipulation. Add error handling so the script does not fail silently on unexpected values.

Variables to customize

{{language}}{{column_definitions}}{{row_count}}{{data_issues}}{{library}}

Why this prompt works

Requiring before/after logging and a summary report turns a cleaning script into an auditable process. Flagging rows for manual review prevents silent data loss.

Save this prompt to your library

Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.