Once you’ve collected your data, the next step is cleaning it: finding and fixing the errors, gaps, and inconsistencies that almost any real dataset contains. Analysis built on messy data gives answers that look precise but can be wrong, and those mistakes are much harder to spot afterward. Cleaning is also not a quick tidy-up. For many people who work with data, it takes more of their time than the analysis itself.1Forbes. Cleaning Big Data: Most Time-Consuming, Least Enjoyable Data Science Task, Survey Says A good deal of it is judgment rather than mechanics, since deciding what counts as an error depends on knowing what the data is supposed to describe.2Proceedings of the International Working Conference on Advanced Visual Interfaces. Profiler
Start by Taking Stock of What You Collected
Before changing a single value, take a structural inventory of the file. Count the rows and columns, check what type of data each column holds, and count the blanks in each field.3Hex. What is exploratory data analysis? A practical guide This catches problems early, before they build on each other in later steps.3Hex. What is exploratory data analysis? A practical guide Typical surprises include a column of numbers stored as text, a date column with thousands of blanks, or a file half the size you expected because something broke during collection.3Hex. What is exploratory data analysis? A practical guide
A five-minute first check on a spreadsheet or survey export is enough to surface most of these. Compare the row count with the number of responses or records you expected; a big shortfall or excess points to an export or collection problem rather than a data problem. Read each column header and a few values beneath it, because exports often rename fields or label them vaguely. Then sort each numeric column from smallest to largest, which pushes impossible entries like negative ages to the top or bottom. Write each problem in a simple log rather than fixing it on the spot. Simple summaries and charts, such as a histogram of each number column, make odd values visible in context.2Proceedings of the International Working Conference on Advanced Visual Interfaces. Profiler
Don’t edit the raw file directly: overwriting the original removes any way to check whether a fix was right. Work on a copy, or in a script, so the raw data stays intact, and keep your log of changes so a colleague or teacher can follow and repeat your steps.
What Clean Data Looks Like
Six common yardsticks give cleaning a target:
- Accuracy: values match reality, such as a customer’s real address.4IBM. What Are Data Quality Dimensions?
- Completeness: the fields you need are filled in.4IBM. What Are Data Quality Dimensions?
- Consistency: the same thing is recorded the same way everywhere, like one date format.4IBM. What Are Data Quality Dimensions?
- Timeliness: the data is current enough for your question.4IBM. What Are Data Quality Dimensions?
- Validity: values follow the rules for that field, such as a month between 1 and 12.4IBM. What Are Data Quality Dimensions?
- Uniqueness: each real person or item appears only once.4IBM. What Are Data Quality Dimensions?
Quality can be measured on several of these at once, with equal or different weights depending on the purpose.5Collibra. The 6 Data Quality Dimensions with Examples So decide up front which ones matter most for your question, and cleaning effort goes where it counts.
To turn the list into a checklist for your own dataset, write one rule for each column, such as ages between 0 and 120. Mark which columns must be complete and which can tolerate blanks. Pick one standard format for dates, names, and units before you begin. When you finish, run the same checklist again to confirm the cleaned file passes.
Validity and accuracy are easy to confuse. A birth year of 1985 is valid for that field but may be wrong for that particular person. Validity checks catch impossible values but cannot confirm true ones, and confirming accuracy often needs a second source, such as the original form.
Handling Missing Values
Filling in missing values can be done simply, by using the column’s average or repeating the last known value. More advanced methods estimate each gap from the other columns.6Hindawi / International Journal of Mathematics and Mathematical Sciences. Performance Comparison of Various Imputation Methods for Missing Data Mechanisms (MAR, MCAR, and MNAR) in a Nonstationary Time Series The methods are not equally good. In a test on time-based data with 10% to 40% of values missing, a method that estimated gaps from multiple variables beat using the average or the last value in every scenario.6Hindawi / International Journal of Mathematics and Mathematical Sciences. Performance Comparison of Various Imputation Methods for Missing Data Mechanisms (MAR, MCAR, and MNAR) in a Nonstationary Time Series Averages are quick but can flatten real variation, so treat them as a rough fix rather than a default.
Deleting incomplete rows is not neutral either. Dropping every record with a missing or invalid entry can shrink some groups more than others, because some groups are more likely to have gaps.7PubMed Central. A Roadmap to Artificial Intelligence (AI): Methods for Designing and Building AI ready Data to promote Fairness Before deleting, check whether the removed records share something, such as a region or age group.
Start by asking why a value is missing, because the answer shapes the fix. A blank can mean the question was never asked, the person refused to answer, the field did not apply, or the value was lost when the file was exported or merged. Blanks created when a survey skips questions that don’t apply are correct: an empty “number of children” for someone who said they have none should stay empty, since filling it would add false information. When people skip a question for a reason, such as leaving out income because it is very high or very low, the remaining answers no longer represent everyone, and simple fixes like the average hide that. Note in your log which explanation applies to each column with gaps.
From there, a beginner can follow a simple path. If only a handful of rows have blanks and they don’t seem to share anything, removing those rows is often a reasonable choice, though it can still bias results if people skipped for a reason. If one column is mostly empty, it may carry too little information to be useful, and dropping the column beats discarding many rows or inventing most of its values. If blanks are spread across many rows, deleting would throw away too much, so fill them with a method suited to the data and say clearly in your report that you did. Whatever you choose, compare a few summary figures before and after, such as the average and group sizes, to see whether the choice shifted your picture of the data.
Spotting Odd and Extreme Values
An outlier is a value far from the rest. A common rule flags anything well above or below the middle half of a column’s values. In one housing dataset, this rule flagged over 100 unusual lot sizes and over 100 unusual sale prices.8Machine Learning Mastery. Spotting the Exception: Classical Methods for Outlier Detection in Data Science Many of those homes are simply large or expensive, so being flagged doesn’t make a value wrong. People cleaning data also often mark unusual but genuine combinations as errors.9arXiv. The Human Factor in Data Cleaning: Exploring Preferences and Biases
For each flagged value, ask a few questions. Is it physically or logically possible? A person aged 250 or a purchase dated in the future is an error, not a rare result. Could a unit or scale mix-up explain it, like a height entered in metres in a column of centimetres? Those can often be corrected with confidence. Does the original source, such as the paper form, receipt, or system record, show a different number? And would removing the value change your main conclusion? If so, report the result both with and without it so readers can judge.
Some errors can be repaired and others must be blanked. In one approach to health records, a blood pressure entered as 9 was treated as a typing slip for 90, while 3000 was blanked because no reasonable correction made sense.10PubMed Central. An automated data cleaning method for Electronic Health Records by incorporating clinical knowledge Automated rules in another health record system remove results that swing from abnormal to normal in under an hour, which can signal a faulty sample.11PubMed Central. Automated Electronic Health Record Data Extraction and Curation Using ExtractEHR Repair a value only when the true one is obvious, and otherwise mark it missing rather than guessing.
Deleting every extreme value is a common mistake. Rare real events, like a record sale, are often the most interesting findings, and removing them makes results look tidier than reality. Keep a note of what you removed and why.
Removing Duplicates and Fixing Inconsistent Formats
Matching records compares shared details such as names and dates of birth, treating two records as the same when most details agree and different when most disagree.12users.cecs.anu.edu.au. A Probabilistic Deduplication, Record Linkage and Geocoding System Records that only look alike, such as two people with similar names, are often wrongly merged, and with high confidence.9arXiv. The Human Factor in Data Cleaning: Exploring Preferences and Biases Check a sample of suspected duplicates by hand before merging them all.
It helps to separate exact copies from near duplicates. Exact copies, often from pasting twice or double submissions, are usually safe to remove, unless two genuinely separate records happen to be identical, such as two identical purchases. Near duplicates need a rule for which version to keep, such as the newest. The remove-duplicates tools built into spreadsheets only catch exact matches.
Inconsistent formats are among the easiest problems to fix. Misspelled units should be corrected and every value in a column converted into one unit.10PubMed Central. An automated data cleaning method for Electronic Health Records by incorporating clinical knowledge Automated tools handle mixed formats well, succeeding about 92% of the time in one comparison.13International Journal of Theoretical & Applied Computational Intelligence. Experimental Evaluation of Automated and Manual Data Cleaning Systems: A Case Study Using Organizational Data
Everyday format chaos is easy to recognize. A company may appear as IBM, I.B.M., and International Business Machines, and a count by name will treat them as three different companies. A date like 03/04/2024 means March 4 in some countries and April 3 in others, so you need to know how the data was entered before converting it to one clear format. Stray spaces or different capitalization can make identical entries look different to a spreadsheet, and trimming spaces and setting one case fixes many of these. Choose one standard spelling or format for each field, apply it with find-and-replace or a formula, and check a sample afterward.
Be careful with cleaning steps that are too blunt. One that drops entries with special characters can silently remove names with accents or tildes.14Big Data and Social Science. Chapter 11 Bias and Fairness
How Long Cleaning Takes
One widely cited survey found data scientists spent about 60% of their time cleaning and organizing data and 19% collecting it.1Forbes. Cleaning Big Data: Most Time-Consuming, Least Enjoyable Data Science Task, Survey Says A separate common claim puts finding, cleaning, and organizing at about 80% of the time, leaving 20% for analysis.15Pragmatic Institute – Resources. Overcoming the 80/20 Rule in Data Science A 2020 survey found preparation took an average of 45% of time, so the share varies a lot between teams.16Amperity. The Cost of Poor Customer Data Quality
The time goes in several places. Each problem has to be found, understood, and then fixed, often one column at a time, which can’t be rushed the way a calculation can. Fixing one issue frequently reveals another; standardizing spellings, for example, may expose duplicates that were hidden before. Some questions can only be answered by the people who collected the data, such as what a code means, and waiting for replies adds time you can’t control.
You can shorten the work next time. Set required fields and dropdown choices in forms to block bad entries, and agree on date and unit formats before collection starts. Save your cleaning steps so the next batch can be cleaned the same way.
Can Software Clean Data for You
In one comparison, automated cleaning fixed invalid values about 88% of the time, and was faster and cheaper on large files.13International Journal of Theoretical & Applied Computational Intelligence. Experimental Evaluation of Automated and Manual Data Cleaning Systems: A Case Study Using Organizational Data But manual cleaning reached 95% accuracy on cases that needed subject knowledge, beating automation there.13International Journal of Theoretical & Applied Computational Intelligence. Experimental Evaluation of Automated and Manual Data Cleaning Systems: A Case Study Using Organizational Data Tools that flag suspicious data still need a person to decide what counts as an error.2Proceedings of the International Working Conference on Advanced Visual Interfaces. Profiler Advanced AI cleaning tools also need lots of computing power, making them costly for small projects.17International Journal of Advance Research Publication and Reviews. Ai and Machine Learning -Powered Automated Data Cleaning Methods: Improving Data Quality For a typical spreadsheet, built-in functions and a careful person usually beat heavy tools.
A beginner can get a long way with tools already at hand. Spreadsheet features such as remove duplicates, filters, sorting, and find-and-replace cover a large share of everyday fixes without any new software. Free tools like OpenRefine can group similar spellings together so you can review them and merge them in one step. Short scripts in Python or R take more effort to learn, but they record every cleaning step so the process can be repeated exactly on new data.
What Careless Cleaning Can Cost
Poor data quality leads to unhappy customers, higher costs, worse decisions, and weaker strategy.18Communications of the ACM. The impact of poor data quality on the typical enterprise Over a quarter of organizations estimate losing more than USD 5 million a year to it.19IBM. The True Cost of Poor Data Quality Errors and outliers left in training data also sharply reduce how accurately prediction models perform.20Procedia Computer Science. Dealing with Noise Problem in Machine Learning Data-sets: A Systematic Review
The damage shows up in small ways too. A customer who appears twice makes a sales total look higher than it really was, and the inflated figure can drive decisions about stock or staffing.
Over-cleaning causes its own harm. Changing data to balance groups can make the final decision less accurate, so fixes involve tradeoffs.21Journal of Data and Information Quality. E-FAIR-DB: Functional Dependencies to Discover Data Bias and Enhance Data Equity
Record every cleaning decision so others can see what was changed and repeat it. A short record names the problem you found and the column it was in, what you changed and how many rows it affected, and why you chose that fix over the alternatives.

