Introduction to Pandas
Learn what Pandas is and why it is the core tool you will use to work with real datasets in Python.
Skill Level: Beginner
Prerequisites: Python Essentials module (Variables, Data Types, Collections)
Estimated Time: 20 minutes
Story Time
In the last module, you started thinking about student exam scores as data and saw how variables and collections can store values in Python.
Now imagine that instead of just a few rows, you have an entire class dataset with hundreds of students, including gender, race/ethnicity, parental education, lunch type, test preparation status, and math, reading, and writing scores—just like the StudentsPerformance dataset you will use in this module.
Looking at that information one cell at a time would be slow and difficult. You would need a better way to organize, explore, and summarize the data.
That is where Pandas comes in.
What You’ll Learn
By the end of this lesson, you will be able to:
- Explain what Pandas is.
- Describe why Pandas is widely used for data analysis.
- Identify the two main Pandas data structures.
- Import the Pandas library into Python.
Why This Topic Matters
As datasets grow, manual work becomes harder.
For example, if you want to find the average math score, identify students who scored above 90, or check whether a test preparation course improved performance, doing everything by hand would quickly become tedious. Pandas gives you tools to work with these questions more efficiently inside Python.
This makes it easier to clean, explore, and summarize tabular data as your datasets get larger.
What Is Pandas?
Pandas is an open-source Python library for working with structured or tabular data.
It helps you:
- Load datasets.
- Organize data.
- Filter records.
- Perform calculations.
- Handle missing values.
- Prepare data for visualization and machine learning.
Pandas is one of the most widely used tools in data analysis because it is practical, flexible, and beginner-friendly once you understand the basics.
Why Is It Called Pandas?
The name Pandas comes from the term Panel Data, which refers to structured datasets used in statistics and economics.
Today, the name is simply associated with the Python library itself. You do not need to remember the history to use the library, but it is helpful to know where the name comes from.
What Can Pandas Read?
Pandas can work with many different data formats:
| File Type | Example |
|---|---|
| CSV | Student records |
| Excel | Financial reports |
| JSON | API responses |
| SQL Databases | Business databases |
| Parquet | Large analytical datasets |
In this course, you will mostly start with CSV and Excel files because they are common and easy to understand.
The Two Main Data Structures
Pandas has two core data structures that you will see often.
Series
A Series stores one column of data.
For example:
72
69
90
47
76
You can think of a Series as a single column in a spreadsheet.
DataFrame
A DataFrame stores an entire table.
| Gender | Math | Reading | Writing |
|---|---|---|---|
| Female | 72 | 72 | 74 |
| Female | 69 | 90 | 88 |
| Male | 90 | 95 | 93 |
Most of your work in Pandas will happen inside DataFrames, since they are the structure used for full datasets.
Importing Pandas
Before using Pandas, you need to import it.
import pandas as pd
This tells Python to load the Pandas library.
The alias pd is a common convention, so you will see it in most data analysis code. It keeps code short and easy to read.
Your First Pandas Program
import pandas as pd
print(pd.__version__)
This prints the version of Pandas installed in your environment.
It is a small first step, but it helps you confirm that the library is ready to use.
Worked Example
import pandas as pd
data = {
"Name": ["Emma", "Alex", "Sophia"],
"Math":
}
df = pd.DataFrame(data)
print(df)
Output:
Name Math
0 Emma 72
1 Alex 85
2 Sophia 91
This example shows how Pandas can turn a simple Python dictionary into a table.
Do not worry if this feels new. In the next lessons, you will learn how to read real datasets like StudentsPerformance into DataFrames step by step.
Practice in the Notebook
After completing the activity in Google Colab, mark it as complete below.
Open the accompanying notebook in Google Colab and run this code:
import pandas as pd
print(pd.__version__)
Then answer:
- Was Pandas already available?
- Which version is installed?
After that, discuss these questions:
- What problems can Pandas solve that would be difficult to solve manually?
- What is the difference between a Series and a DataFrame?
- Why do most Python programs import Pandas as
pd?
You can also try creating a small DataFrame of your own, for example:
data = {
"Name": ["Emma", "Alex"],
"Math":
}
df = pd.DataFrame(data)
print(df)
Challenge
Think about a dataset you might want to analyze, such as student scores, weather records, or shopping data.
Write a short response that answers:
- What kind of data would it contain?
- Would it be better as a Series or a DataFrame?
- What kind of question could you answer with it?
Self Evaluation
Check Your Understanding
1. What is Pandas?
2. Why is Pandas useful in data analysis?
3. What does a Series store?
4. What does a DataFrame store?
5. Why do many Python data projects use import pandas as pd?
Key Takeaways
In this lesson, you learned that:
- Pandas is a Python library for working with tabular data.
- It is widely used because it makes data analysis easier.
- A Series stores one column of data.
- A DataFrame stores an entire table.
- You can import Pandas using
import pandas as pd.
Continue Your Journey
Now that you know what Pandas is, the next step is to learn how to load real datasets into Pandas DataFrames and start exploring the StudentsPerformance dataset in your notebook.