Hiring Partners
Segilola Resources Operating LimitedTaviatech TechnologiesFCMBMTN NigeriaAdvans La Fayette Microfinance BankAboki AfricaFirst Bank of NigeriaOPay
โ† Basic Data Transformation ยท Lesson 4 of 9

Module Three

๐Ÿ“– Every lesson in this course is free to read right here, no account needed. Create a free account to track your progress, take the exam, and earn your certificate.
4
Module 3: Cleaning and Preparing Data

Module 3: Cleaning and Preparing Data

Welcome to Module 3!

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.

1. What Is Data Cleaning?

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.

Example: An Untidy Student Record

Name Age Class Score
DAVID 13 JSS2 85
Mary jss2 78
Samuel 14 JSS3 90
Mary jss2 78

Can you identify the problems?

  • DAVID is written in uppercase.
  • Mary's age is missing.
  • Some class names use different formats.
  • Mary's record appears twice.

These are examples of problems that data cleaning can help us identify and correct.

2. Understanding Common Data Problems

Before cleaning data, you must understand the problems that can make information difficult to use.

A. Missing Information

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.

B. Duplicate Records

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.

Important: Two people can have the same name. Never delete a record just because the name appears twice. Check a unique identifier, such as a student ID, before deciding whether it is a duplicate.

C. Spelling Mistakes

Spelling mistakes happen when information is entered incorrectly.

Incorrect Entry Correct Entry
Ibadan Ibadan
Abujaa Abuja
Mathematic Mathematics
Oyo state Oyo State

D. Inconsistent Information

Inconsistent information happens when the same type of information is written in different ways.

For example:

  • JSS2
  • JSS 2
  • Junior Secondary 2

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.

E. Unnecessary Spaces

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.

3. How to Handle Missing Information

When you discover missing information, you should not automatically guess what the correct value should be.

There are several ways to handle missing data.

Method 1: Check the Original Record

This is usually the best option. If a student's age is missing, check the original registration form or another reliable record.

Method 2: Mark the Information as Missing

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.

Method 3: Use an Approved Replacement Value

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.

Remember: Never invent a student's age, examination score, phone number, or other personal information just to fill an empty space.

4. Removing Duplicate Records

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:

  1. Identify the records that look similar.
  2. Compare their unique identification numbers.
  3. Check whether they represent the same real record.
  4. Confirm which record should be kept.
  5. Remove only confirmed duplicates.

Example

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.

5. Correcting Spelling and Formatting Mistakes

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.

6. Introduction to Data Validation

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.

Examples of Data Validation Rules

Field Validation Rule
Age Must be within an approved age range.
Email 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.

7. Introduction to Cleaning Data with Spreadsheets

You can clean data using spreadsheet applications such as Microsoft Excel and Google Sheets.

Some useful spreadsheet features include:

  • Find and Replace: Finds a value and replaces it.
  • Remove Duplicates: Helps identify repeated records.
  • Sort: Arranges information in a chosen order.
  • Filter: Displays records that match selected conditions.
  • TRIM: Removes extra spaces from text.

Example: Using the TRIM Function

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

Example: Changing Text to Uppercase

If cell A2 contains the name Mary, you can use:

=UPPER(A2)

The result will be:

MARY

Example: Changing Text to Lowercase

=LOWER(A2)

If A2 contains DAVID, the result will be:

david
Important: Spreadsheet functions help you clean information faster. Always check the results to make sure the changes are correct.

8. Practical Activity: Clean a Student Dataset

Your Challenge!

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:

  1. Which student name contains extra spaces?
  2. Which student's age is missing?
  3. Which examination score needs investigation?
  4. Which student record appears more than once?
  5. Which class entry needs standardising?

Your Practical Tasks

  1. Remove unnecessary spaces from names.
  2. Make all student names follow the same format.
  3. Standardise class names as JSS 1, JSS 2, and JSS 3.
  4. Check the missing age using the original school record.
  5. Investigate the score of 105 because the approved maximum is 100.
  6. Confirm and remove the duplicate ST001 record.
  7. Save your cleaned dataset.

You can complete this exercise using a notebook, Microsoft Excel, or Google Sheets.

9. Checking Your Cleaned Dataset

After cleaning data, you should inspect it again. This is important because you may accidentally change something incorrectly.

Use this checklist:

  • Are there any confirmed duplicate records remaining?
  • Are important values missing?
  • Are names and classes written consistently?
  • Are there values outside the approved range?
  • Have you checked questionable information against reliable records?
  • Have you saved a copy of the original dataset?
Protect the Original Data: Always keep a backup of the original dataset before making major changes. This allows you to recover information if something goes wrong.

10. Important Terms to Remember

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.

11. Module Summary

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.

Key Lesson: Good data transformation starts with good data cleaning. Always check your information before using it to make decisions or prepare reports.

12. Module 3 Assessment

Answer all ten questions. Select the correct option for each question.

1. What is data cleaning?



2. What is a missing value?



3. What is a duplicate record?



4. What should you do when a student's age is missing?



5. Which spreadsheet function removes extra spaces?



6. What does data validation mean?



7. Why should you check student IDs before removing duplicates?



8. Which examination score needs investigation if the maximum is 100?



9. Why should you keep a backup of your original dataset?



10. What should you do after cleaning a dataset?



๐Ÿ† Get Certified

๐Ÿ”’

Earn this certificate

Every lesson is already free to read. Sign up, finish the lessons, pass the exam (โ‚ฆ2,000 or 20,000 coins), and get a verified certificate with your name on it.

๐ŸŽ“ Sign Up to Get Certified
๐Ÿ› ๏ธ Practice Tools
Hands-on simulators & labs - subscription required.
โ†’
๐ŸŽฏ Internship Tasks
Real-world tasks to build your portfolio - unlock them with a subscription.
โ†’