Hiring Partners
Segilola Resources Operating LimitedTaviatech TechnologiesFCMBMTN NigeriaAdvans La Fayette Microfinance BankAboki AfricaFirst Bank of NigeriaOPay
โ† Data Analysis Tools Overview ยท Lesson 5 of 10

Module Four

๐Ÿ“– 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.
5
Module 4: Programming Tools for Data Analysis

Module 4: Programming Tools for Data Analysis

1. Introduction to Programming Tools

Welcome to Module Four!

In the previous module, you learned about databases and SQL. You discovered how organisations store information and how data analysts retrieve information from databases.

Now, let's explore another important part of data analysis: programming tools.

Imagine that a company has collected information about 100,000 customers. The company wants to calculate how much each customer spends, identify its most popular products, and discover buying patterns.

Doing all these calculations manually would take a very long time.

Programming tools allow data analysts to give computers instructions to perform these tasks automatically.

In this module, you will learn about Python, R, Jupyter Notebook, Pandas, and NumPy.

2. What Is Programming?

Programming means writing instructions that tell a computer what to do.

Think about giving someone directions to your school. You might say:

  1. Leave your house.
  2. Walk to the main road.
  3. Turn left.
  4. Continue until you reach the school gate.

These instructions explain how to complete a task.

Programming works in a similar way. We write instructions using a programming language, and the computer follows those instructions.

Why Do Data Analysts Use Programming?

  • To calculate large amounts of information.
  • To clean messy datasets.
  • To discover patterns in information.
  • To automate repeated tasks.
  • To create charts and reports.
  • To work with large datasets.

3. Introduction to Python

Python is a popular programming language used for many activities, including data analysis, artificial intelligence, website development, and automation.

Python is popular because its instructions are relatively easy to read and understand.

Example of Python Code

Look at this simple instruction:

print("Hello, Data Analyst!")

This instruction tells the computer to display the words:

Hello, Data Analyst!

Another example:

print(10 + 20)

The computer will calculate the answer and display:

30

Real-Life Example

Imagine that a shop in Ibadan sells 15 bags of rice in the morning and 20 bags in the afternoon.

You can use Python to calculate the total number of bags sold.

morning_sales = 15
afternoon_sales = 20

total_sales = morning_sales + afternoon_sales

print(total_sales)

Result:

35

Python has calculated the total automatically!

4. Understanding Python Variables

A variable is a named place where a program stores information temporarily while it runs.

Think of a variable as a labelled container.

For example, imagine you have a box labelled Age. You put the number 13 inside it.

In Python, you can write:

age = 13

print(age)

The result will be:

13

You can also store names and other information.

student_name = "John"
score = 85
school = "CRMNuggets Academy"

print(student_name)
print(score)
print(school)

Variables make it easier to store and work with information.

5. Understanding Python Lists

A list allows you to store several items in one variable.

Imagine that you want to store the examination scores of five students.

Instead of creating five separate variables, you can use a list.

scores = [75, 80, 90, 65, 85]

print(scores)

Python will display:

[75, 80, 90, 65, 85]

You can also calculate the total and average of these scores.

scores = [75, 80, 90, 65, 85]

total = sum(scores)
average = sum(scores) / len(scores)

print("Total:", total)
print("Average:", average)

This is useful when working with examination results, sales records, and other datasets.

6. Introduction to Jupyter Notebook

Jupyter Notebook is a tool that allows people to write and run programming code in separate sections called cells.

It is widely used by data analysts, researchers, teachers, and students.

What Makes Jupyter Notebook Useful?

  • You can write Python code.
  • You can run code one section at a time.
  • You can display charts and tables.
  • You can add explanations using text.
  • You can experiment with data and see the results.

Example

Imagine that you want to calculate the average score of three students.

You can enter this code in a Jupyter Notebook cell:

scores = [70, 80, 90]

average = sum(scores) / len(scores)

print(average)

When you run the cell, Jupyter Notebook displays the answer.

7. Introduction to Pandas

Pandas is a Python library used for working with structured data.

A library is a collection of ready-made instructions that programmers can use instead of writing everything from the beginning.

Pandas is especially useful for working with information arranged in rows and columns.

What Can Pandas Do?

  • Read information from Excel files.
  • Read information from CSV files.
  • Organise information into tables.
  • Find missing information.
  • Remove duplicate records.
  • Calculate totals and averages.
  • Filter and sort information.

Example of Pandas

First, we import the Pandas library.

import pandas as pd

Next, we create a small dataset.

data = {
    "Name": ["John", "Mary", "David"],
    "Score": [80, 90, 75]
}

students = pd.DataFrame(data)

print(students)

Expected result:

Name Score
John 80
Mary 90
David 75

Pandas has organised the information into a table called a DataFrame.

8. Understanding DataFrames

A DataFrame is a table-like structure provided by Pandas.

It contains rows and columns, just like a spreadsheet.

For example, a school might have a DataFrame containing:

  • Student names.
  • Examination scores.
  • Class levels.
  • Attendance records.

DataFrames make it easier to analyse information using Python.

Example: Finding the Average Score

import pandas as pd

data = {
    "Student": ["John", "Mary", "David"],
    "Score": [80, 90, 70]
}

students = pd.DataFrame(data)

average = students["Score"].mean()

print("Average Score:", average)

Result:

Average Score: 80.0

9. Introduction to NumPy

NumPy is another important Python library used for numerical calculations.

It helps programmers work with large collections of numbers efficiently.

What Can NumPy Do?

  • Perform mathematical calculations.
  • Work with collections of numbers.
  • Calculate averages.
  • Find the highest and lowest values.
  • Perform calculations on arrays.

Example of NumPy

First, import the NumPy library.

import numpy as np

Next, create an array of examination scores.

scores = np.array([70, 80, 90, 60, 100])

print(scores)

You can calculate the average:

average = np.mean(scores)

print(average)

Result:

80.0

NumPy makes numerical calculations easier when working with data.

10. Introduction to R Programming

R is a programming language designed mainly for statistical computing and data visualisation.

It is used by researchers, statisticians, scientists, and data analysts.

What Can R Do?

  • Calculate averages and percentages.
  • Perform statistical analysis.
  • Create charts and graphs.
  • Study patterns in information.
  • Analyse research data.

Example of R Code

Imagine that you want to calculate the average examination score of five students.

scores <- c(70, 80, 90, 60, 100)

average <- mean(scores)

print(average)

Result:

[1] 80

R has calculated the average score automatically.

11. Difference Between Python and R

Python and R are both useful programming languages for data analysis.

Feature Python R
Main Uses Data analysis, automation, AI, and software development Statistics, research, and data visualisation
Popular Libraries Pandas and NumPy dplyr and ggplot2
Learning Beginner-friendly syntax Useful for statistical learning
Applications Business, technology, science, and AI Research, science, and statistics

Both languages are valuable. You do not need to learn both immediately. Beginners can start with Python and explore R later.

12. How Programming Tools Work Together

Data analysts sometimes combine different programming tools to complete a project.

For example, imagine that a supermarket wants to understand its monthly sales.

  1. SQL retrieves the sales information from the company's database.
  2. Python helps clean and organise the information.
  3. Pandas helps arrange the information into tables.
  4. NumPy helps perform numerical calculations.
  5. Jupyter Notebook allows the analyst to write code and review results.
  6. Power BI can display the findings in a dashboard.

Each tool performs a different task, but together they help solve the business problem.

13. Where Can You Practise Python?

You do not need an expensive computer to begin learning Python.

There are online tools that allow you to write and run Python code.

  • Google Colab: An online environment for writing and running Python code.
  • Jupyter Notebook: A notebook environment for programming and data analysis.
  • Replit: An online coding platform for practising programming.
  • Visual Studio Code: A code editor that supports Python through extensions.

For beginners, Google Colab is a convenient starting point because you can practise Python in a web browser.

14. Practical Activity

Project: Analyse Examination Scores Using Python

Imagine that you are a data analyst helping a teacher understand the examination performance of five students.

Use Python to complete the following tasks.

Step 1: Create a List of Scores

scores = [75, 80, 90, 65, 85]

print(scores)

Step 2: Calculate the Total

total = sum(scores)

print("Total Score:", total)

Step 3: Calculate the Average

average = sum(scores) / len(scores)

print("Average Score:", average)

Step 4: Find the Highest Score

highest = max(scores)

print("Highest Score:", highest)

Step 5: Find the Lowest Score

lowest = min(scores)

print("Lowest Score:", lowest)

Your Challenge: Change the scores and run the program again. Observe how the answers change automatically.

15. Knowledge Check

Answer the following questions to test your understanding.

  1. What is programming?
  2. What is Python used for in data analysis?
  3. What is a variable in programming?
  4. What is a Python list?
  5. What is Jupyter Notebook?
  6. What is Pandas used for?
  7. What is a DataFrame?
  8. What is NumPy used for?
  9. What is R programming commonly used for?
  10. Give two differences between Python and R.
  11. Name one online platform where you can practise Python.
  12. How can Python and SQL work together in a data analysis project?

16. Module Summary

Congratulations! You have completed Module Four of Data Analysis Tools Overview.

In this module, you learned:

  • What programming means.
  • Why data analysts use programming tools.
  • Introduction to Python and its basic instructions.
  • How variables and lists work.
  • What Jupyter Notebook is used for.
  • How Pandas helps organise and analyse data.
  • What DataFrames are.
  • How NumPy supports numerical calculations.
  • Introduction to R programming.
  • How different programming tools work together.

Coming Up Next

Module 5: Data Visualisation and Business Intelligence Tools

In the next module, you will discover how data analysts turn numbers into charts, graphs, and interactive dashboards. You will explore Microsoft Power BI, Tableau, and other tools used to present information in a simple and understandable way.

Keep practising your programming skills. You are building the foundation for a successful journey into data analysis!

CRMNuggets โ€“ Learn. Practice. Get Certified.

๐Ÿ† 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.
โ†’