Imagine that your teacher gives you a list of 100 students. When you look through the list, you discover that some names are repeated, some ages are missing, and some names are incorrectly written.
Can you use the information immediately to prepare an examination report?
Probably not. You first need to check and correct the data. This process is called data cleaning.
In this module, you will learn how to identify problems in a dataset and prepare the information for use.
Data cleaning is the process of finding and correcting problems in a dataset so that the information becomes more accurate, complete, and organised.
Think of data cleaning like cleaning your bedroom. You remove unwanted items, arrange your books, and put everything in the right place.
Data cleaning does something similar, but instead of cleaning a room, you are organising information.
| Name | Age | Class | Score |
|---|---|---|---|
| DAVID | 13 | JSS2 | 85 |
| Mary | jss2 | 78 | |
| Samuel | 14 | JSS3 | 90 |
| Mary | jss2 | 78 |
Can you identify the problems?
These are examples of problems that data cleaning can help us identify and correct.
Before cleaning data, you must understand the problems that can make information difficult to use.
Missing information happens when an important value is not recorded in a dataset.
For example, a student record may contain a name and class but no age.
| Name | Age | Class |
|---|---|---|
| Grace | 13 | JSS2 |
| Peter | JSS3 |
Peter's age is missing. We should check the original registration record before adding the correct age.
A duplicate record is information that has been entered more than once when it should only appear once.
| Student ID | Name | Class |
|---|---|---|
| ST001 | David | JSS2 |
| ST002 | Mary | JSS2 |
| ST001 | David | JSS2 |
The record with student ID ST001 appears twice. This may be a duplicate.
Spelling mistakes happen when information is entered incorrectly.
| Incorrect Entry | Correct Entry |
|---|---|
| Ibadan | Ibadan |
| Abujaa | Abuja |
| Mathematic | Mathematics |
| Oyo state | Oyo State |
Inconsistent information happens when the same type of information is written in different ways.
For example:
These entries may refer to the same class, but they are written differently.
We can standardise them by choosing one format, such as JSS 2, and using it throughout the dataset.
Sometimes information contains extra spaces before or after a word.
Examples:
" David "" Mary""Samuel "These spaces may cause problems when searching, comparing, or organising information.
We can remove unnecessary spaces to produce: David, Mary, and Samuel.
When you discover missing information, you should not automatically guess what the correct value should be.
There are several ways to handle missing data.
This is usually the best option. If a student's age is missing, check the original registration form or another reliable record.
If you cannot find the correct information, you can leave
the field empty or use a clear label such as
Not Provided, depending on the system.
In some data projects, a missing value can be replaced using an approved method. For example, a data analyst may use the average of other values.
However, this should only be done when it makes sense for the task.
Duplicate records can make reports incorrect. For example, if a student's score is counted twice, the class statistics may become inaccurate.
Follow these steps when checking for duplicates:
| Student ID | Name | Score |
|---|---|---|
| ST101 | Grace | 88 |
| ST102 | Peter | 75 |
| ST101 | Grace | 88 |
ST101 appears twice with the same details. After confirming that these are duplicate entries, one copy can be removed.
A dataset should follow a consistent style. This makes it easier to read and search.
Consider these examples:
| Before Cleaning | After Cleaning |
|---|---|
| DAVID | David |
| mary | Mary |
| jss2 | JSS 2 |
| ibadan | Ibadan |
| Samuel | Samuel |
These changes make the information more consistent.
Data validation means checking whether information follows certain rules before accepting or using it.
Imagine that a school registration form asks students to enter their age.
The school may decide that students must enter an age between 10 and 20 for a particular registration category.
If someone enters 150, the system should flag the value for checking.
| Field | Validation Rule |
|---|---|
| Age | Must be within an approved age range. |
| Must follow a valid email format. | |
| Examination Score | Must be between 0 and 100. |
| Student ID | Must follow the school's ID format. |
Validation does not always prove that information is correct. It helps identify values that do not follow the rules. A value can follow the rules and still be factually wrong.
You can clean data using spreadsheet applications such as Microsoft Excel and Google Sheets.
Some useful spreadsheet features include:
Imagine that cell A2 contains the name with extra spaces:
" David "
In Excel or Google Sheets, you can use:
=TRIM(A2)
The result will be:
David
If cell A2 contains the name Mary, you can use:
=UPPER(A2)
The result will be:
MARY
=LOWER(A2)
If A2 contains DAVID, the result will be:
david
A school in Ibadan has provided the following student records. Unfortunately, the records contain several errors.
| Student ID | Name | Age | Class | Score |
|---|---|---|---|---|
| ST001 | DAVID | 13 | JSS2 | 85 |
| ST002 | Mary | jss2 | 78 | |
| ST003 | Samuel | 14 | JSS3 | 105 |
| ST001 | DAVID | 13 | JSS2 | 85 |
| ST004 | Peter | 12 | JSS1 | 70 |
Identify the problems:
You can complete this exercise using a notebook, Microsoft Excel, or Google Sheets.
After cleaning data, you should inspect it again. This is important because you may accidentally change something incorrectly.
Use this checklist:
| Term | Simple Meaning |
|---|---|
| Data Cleaning | Finding and correcting problems in information. |
| Missing Value | Information that has not been provided. |
| Duplicate | A repeated record. |
| Inconsistent Data | Information written in different formats. |
| Data Validation | Checking whether information follows set rules. |
| TRIM | A spreadsheet function that removes extra spaces. |
| Backup | An extra copy of information kept for safety. |
In this module, you learned that data may contain errors that make it difficult to use.
You discovered how to identify missing information, duplicate records, spelling mistakes, inconsistent formats, and unnecessary spaces.
You also learned about data validation and how spreadsheet functions can help clean information.
Answer all ten questions. Select the correct option for each question.