The Data Analyst’s Guide to Data Cleaning: Right Tools, Right Steps
Updated: Nov 11
A practical, seven-step guide to data cleaning, and how to pick the right tool for the size of your dataset.
Data cleaning is the foundation of trustworthy analysis. Every chart, forecast, and recommendation relies entirely on the data beneath it. A single duplicated customer or a date stored in two different formats can quietly skew a result, and no one notices until a stakeholder asks why the numbers don't add up.
The process of cleaning is fairly universal. The question that trips people up is where to do it. The answer depends mostly on how big your dataset is, so let's start there.

Where to Clean: Match the Tool to the Dataset
When you are dealing with data cleaning, there isn't a single tool that fits every situation. Instead, the size of your dataset and how often you need to repeat the work should guide your choice.
Here is how to pick the right tool for the job based on data volume:
📊Small Datasets (Up to ~100,000 rows): Power Query & Power BI
When your data fits comfortably into memory, visual tools give you immediate feedback and a quick setup.
Why it works: The Power Query editor lets you remove duplicates, fix data types, and standardize text without writing a single line of code.
The big benefit: Every transformation step you make is recorded visually. When your data refreshes, the entire sequence reruns automatically. You can step backward or forward through your applied steps to see the exact effect of each change as you go.
🐍Medium Datasets (100,000 to a few million rows): Python
Once your data outgrows the comfort zone of a visual interface, you need a language built for speed and programmatic control.
Why it works: Python (specifically the pandas library) allows you to perform highly complex operations like finding missing values, imputation, outlier detection, and complex reformatting with ease.
The big benefit: Because your cleaning workflow is saved as a script, you write the logic once and can instantly rerun it on every new file or automate it inside a larger data pipeline.
🗄️Large Datasets (Tens of millions of rows and up): SQL
When datasets reach massive scales, the golden rule is simple: Clean the data where it lives.
Why it works: Pulling huge tables out of a cloud data warehouse onto your local machine is slow, memory-intensive, and often completely impossible.
The big benefit: Pushing the heavy lifting directly into your database or data warehouse using SQL allows deduplication, structural filtering, and text standardization to run across the full dataset in place, leveraging the database's processing power.
These thresholds are rules of thumb, not hard limits. Pick based on dataset size and how often you'll repeat the work: a small file you receive every week may still deserve a script, while a massive one-time historical dump might require SQL staging before any analysis can begin.
Whichever tool you choose, the cleaning steps are the same.
Step 1: Eliminate Duplicates.
Duplicates inflate counts, distort totals, and warp your averages. They typically creep into your dataset through repeated system exports, pipeline glitches, or manual entry errors.
Define uniqueness: Identify what makes a record truly unique—whether it is a Patient Id, Visit Id, or a specific combination of fields like Patient Id and Visit Id, .
Catch near-duplicates: Look out for text inconsistencies that bypass basic filters, such as "St. Jude Hospital" vs. "St Jude Hospital Inc."
Verify before deleting: Always inspect a sample of flagged rows first. Two identical records for a patient when they undergo multiple iterations of the same test (such as serial blood pressure readings, glucose checks) within a single visit or across a timeline.
ℹ️ Tool Tips: Use Remove Duplicates in Excel/Power Query, DISTINCT or ROW_NUMBER() window functions in SQL, and .drop_duplicates() in Python Pandas.
Step 2: Remove Irrelevant data
Not every row or column in a dataset belongs in your analysis. Irrelevant data adds noise, slows down processing, and can distort your results. Removing it early means every later step has less to clean.
Look for:
Out-of-scope rows: records outside the time period, region, or product line your question is about
Test or dummy records: entries created by developers or QA that never reflected real activity
Unused columns: internal system fields, fully empty columns, or fields you will never analyze
Unneeded sensitive data: personal details such as names or email addresses that the analysis doesn't require.
💡 Pro-Tip: As you filter, keep a strict count of exactly how many rows and columns you removed. You will need to account for these changes later when you get to the documentation phase.
ℹ️ Tool Tips: Use WHERE filters in SQL, boolean masking and .drop() in Python Pandas, or Filter Rows and Remove Columns directly in the Power Query editor.
Step 3: Deal with Missing Values
Missing values are inevitable in real-world data. There is no single "right" way to fix them, but you have three primary strategies depending on the context:
Drop: Remove the rows or columns entirely if the missing portion is very small, random, and won't bias your results.
Impute: Fill in the gaps using the mean, median, mode, or a more advanced predictive model.
⚠️ A Word of Caution: Always ask why the data is missing. A blank space in an optional customer survey means something entirely different from a blank space in a required payment amount field. Over-imputing with averages can artificially flatten your data's natural variance, making your final analysis look far more certain than it actually is.
Step 4: Standardize Formats
Inconsistent formatting leads to silent errors that ruin your groupings, sorting, and database joins.
To prevent this, establish a single standard for every field and enforce it across the entire dataset:
Dates: Convert all timestamps to a single format (ISO YYYY-MM-DD is the safest global standard).
Text: Trim accidental trailing whitespace and enforce a consistent casing rule (e.g., lowercasing all email addresses).
Units: Convert mixed currencies, weights, or distances into a single uniform metric.
Data Types: Ensure numbers are stored as integers/floats and booleans as true/false, rather than leaving them trapped as raw text strings.
Step 5: Spot and Handle Outliers
Outliers are data points that sit unusually far away from the rest of your observations. They fall into two distinct camps:
Anomalies & Errors: Plainly impossible values, weights of 0 kg, heights of 0.35 m, vitals (pulse, resp, SBP, DBP) of 0. These should be removed or corrected.
True Extremes: Legitimate but rare events, like lab readings are too high, incase of genuinely sick patient
How to spot them: Use summary statistics, box plots, or statistical boundaries like the Interquartile Range (IQR) and Z-scores.
How to handle them: Investigate the root cause before acting. If an extreme value is real, keep it. Consider running and reporting your final analysis both with and without the outlier. Deleting data points simply because they complicate your charts will distort your findings.
Step 6: Check That the Data Makes Sense
Once the cleaning is done, you must run a quality check to ensure the resulting dataset actually makes logical sense.
Range checks: Are all lab values within expected range?
Logical checks: Does the end_date always come after the start_date? Do the lab values like heart rate is not Zero.
Cross-source checks: Does your cleaned row total or sum match the original source system?
Row count audits: Keep an eye on your baseline. Did you lose or gain rows unexpectedly during a complex join or filter?
Step 7: Future-Proof Your Logic with Clear Documentation
This step will help you and teammates to refer in future about the cleaning steps.
Maintain a changelog: Record exactly what you changed and why. Note which duplicates were removed, how you handled missing nulls, and what assumptions you made about outliers.
Good documentation allows others to peer-review your logic and protects you when a stakeholder asks months down the line: "Why does this dashboard look different from last quarter's report?"
Never overwrite your raw data. Always keep your raw source files untouched and save your cleaned output as a separate, distinct version.
Final Thoughts
Data cleaning isn't glamorous, but it is where trustworthy analysis begins. Choose your tool based on dataset size and how often you'll repeat the task, work through the seven steps in order, and document them. Clean data leads to clear insights.


