BestPromptFinder
Home › Data / Analysis › Clean a Messy Dataset With Pandas
Clean a Messy Dataset With Pandas
85AI Quality /100
90AI Usefulness est. /100
86Eval Confidence /100
No votes yetCommunity results
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
- Hand-picked, editorially reviewed prompt
- Written for ChatGPT, Claude, Gemini
Source
Created by BestPromptFinder — editorial prompt, not user-generated. See our content & source policy.
Related Data / Analysis prompts
CRM Executive and Sales DashboardQuality 95 · Gemini, GPT-5.6, ClaudeForecast and Scenario Model
Quality 91 · Microsoft Copilot in ExcelMessy Dataset Cleanup Plan
Quality 90 · Microsoft Copilot in ExcelProduct Profitability Analysis
Quality 90 · Microsoft Copilot in ExcelInventory Reorder Planner
Quality 90 · Microsoft Copilot in ExcelMarketing Attribution Analysis
Quality 90 · Microsoft Copilot in Excel