Advanced level · Module 5: Data Analysis with pandas · Lesson 1 of 4
Loading and Exploring Data with pandas
Read CSV and Excel files into DataFrames and understand their structure.
In this lesson you will
- Load data and inspect it with head, info and describe
- Select rows and columns
Key concepts
DataFramedtypeloc/ilocboolean filtering
The lesson
pandas is the standard Python tool for working with tables of data. A DataFrame is like a spreadsheet you control with code; pd.read_csv() and pd.read_excel() load files into one.
Start every analysis by looking: df.head() shows the first rows, df.info() lists columns and types, df.describe() summarises the numbers. Check the number of rows and whether values are missing.
Select columns with df['county'] and filter rows with conditions: df[df['grade'] == 5]. value_counts() quickly counts how often each value appears.
Step by step
- Load the enrolment CSV into a DataFrame.
- Inspect it with head(), info() and describe().
- Filter Grade 5 girls and count them by county.
- Answer the five questions and keep the code for each.
Practice activity
Load a school enrolment dataset and answer five questions such as 'how many girls enrolled in Grade 5 by county?'.
Expected result: Correct answers to all five questions with the code used.
Check your understanding
-
Which method shows column types and missing-value counts?
Show answer
DataFrame.info()
Further learning
Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.