BestPromptFinder
Home › Data / Analysis › Clean a Messy Dataset With Pandas

Clean a Messy Dataset With Pandas

Data / Analysis · ChatGPT, Claude, Gemini · data
85AI Quality /100
90AI Usefulness est. /100
86Eval Confidence /100
No votes yetCommunity results

Quality, usefulness and confidence are AI evaluations out of 100 — not user ratings. Community results come from visitors' "worked / didn't work" votes below. How scoring works →

The prompt

Write a Python pandas script to clean my messy data file. File: [CSV / Excel], roughly [N] rows. Columns and what's wrong with them (paste the first 10 rows if you can, with private data replaced): [e.g. dates in mixed formats, phone numbers with spaces and +91, duplicate customers, 'N/A' and blanks, amounts stored as text with Rs and commas, city names spelled differently] What I need at the end: [a clean CSV / an Excel file / a summary table] The script should: 1. Load the file and print a quick profile: column types, missing values, duplicates. 2. Clean step by step, each step in its own clearly commented block: trim spaces, standardise text case, parse dates, convert amounts to numbers, normalise phone numbers, map spelling variants, handle missing values (state the rule used), remove exact duplicates. 3. Never overwrite the original file; save to a new file. 4. Write a short log: rows before and after, and what each step changed. 5. Flag rows it couldn't fix in a separate 'needs_review' file. Explain how to run it for someone new to Python.
Find similar in the app →
Did this prompt work for you?

Why this prompt

Source

Created by BestPromptFinder — editorial prompt, not user-generated. See our content & source policy.

Related Data / Analysis prompts

CRM Executive and Sales Dashboard
Quality 95 · Gemini, GPT-5.6, Claude
Forecast and Scenario Model
Quality 91 · Microsoft Copilot in Excel
Messy Dataset Cleanup Plan
Quality 90 · Microsoft Copilot in Excel
Product Profitability Analysis
Quality 90 · Microsoft Copilot in Excel
Inventory Reorder Planner
Quality 90 · Microsoft Copilot in Excel
Marketing Attribution Analysis
Quality 90 · Microsoft Copilot in Excel