# Clean a messy dataset

A step-by-step cleaning plan for duplicates, missing values, formats, and outliers.

- Topic: Data & Analysis
- Framework: RCTFVV
- Level: Advanced
- Tags: Data & Analytics, Analyze, Plan, Fill-in Template
- Source: https://www.thinkwithprompt.com/prompts/clean-a-messy-dataset

## Prompt

```text
Role: Act as a data analyst assessing and preparing a business dataset.

Context: Dataset description and schema (columns, types, meaning, grain): [SCHEMA]. Sample rows or profile stats: [PROFILE]. Known issues: [KNOWN_ISSUES]. Intended analysis / use: [INTENDED_USE]. Business rules the data should obey: [BUSINESS_RULES]. Tools available: [TOOLS].

Task: Produce: (1) a data-quality assessment - completeness, validity, consistency, uniqueness, accuracy signals, and timeliness, each with what you found and its severity for the intended use; (2) a cleaning plan - each issue, the transformation to apply, the rule, and what could go wrong; (3) the validation checks to run after cleaning (row counts, distributions, referential integrity, business-rule checks); (4) the issues that need a data-owner decision rather than a technical fix.

Format: Sections: Data-quality assessment (table) | Cleaning plan (table: issue | transform | rule | risk) | Post-clean validation checks | Needs a data-owner decision. ~500 words.

Verification: Do not silently drop or impute without flagging the impact on the intended analysis; quantify how many rows each step affects. Flag assumptions about column meaning.

Validation: Check the plan against the intended analysis: would the cleaned dataset actually support it, or does a fix distort the metric that matters? Adjust.
```

## What to fill in

- SCHEMA
- PROFILE
- KNOWN_ISSUES
- INTENDED_USE
- BUSINESS_RULES
- TOOLS

Free to copy and use. From ThinkWithPrompt (https://www.thinkwithprompt.com/), a library of 2,663 curated AI prompts.
