Why You Need to Test Your Pandas Skills Before Moving Forward
If you've spent any time learning Python for data analysis, you already know that Pandas is the backbone of almost every real-world data science workflow. But here's the problem: many learners read about Pandas, watch tutorials, and nod along — without ever truly testing whether they can apply these skills independently.
That's exactly why practice exercises matter. They force you to recall syntax, make decisions about which method to use, and debug your own logic — the same skills you'll need when working with messy, real-world datasets. Below, you'll find 15 carefully designed Pandas practice exercises covering everything from basic DataFrame creation to data cleaning, filtering, grouping, and file I/O. Try to solve each one before checking the explanation, and treat this as a genuine Pandas Python quiz for yourself.
Section 1: DataFrame Fundamentals
Exercise 1: Create a DataFrame from Scratch
Create a DataFrame representing five students with columns for name, age, and score. Then print the index, values, and dtypes of the DataFrame.
Skill tested: Understanding core DataFrame properties like index, values, and dtype — the same fundamentals covered when learning how Pandas builds on NumPy to create labeled, tabular data structures.
Exercise 2: Inspect Your Dataset
Given any DataFrame, use .info() and .describe() to summarize its structure and statistics. What's the difference between what each method reveals?
Skill tested: Dataset inspection — a critical first step before performing any analysis.
Exercise 3: Add a Calculated Column
Add a new column called grade to your student DataFrame that assigns "Pass" if score >= 60 and "Fail" otherwise.
Skill tested: Creating new columns based on conditional logic, a common real-world requirement in reporting workflows.
Section 2: Indexing, Selection, and Filtering
Exercise 4: Practice .loc vs .iloc
Using a DataFrame with a custom string index, retrieve a specific row using .loc, then retrieve the same row using .iloc with its positional index.
Skill tested: Understanding the difference between label-based selection (.loc) and position-based selection (.iloc) — a frequent source of confusion for beginners.
Exercise 5: Boolean Filtering
Filter your student DataFrame to return only rows where age > 18 AND score >= 75.
Skill tested: Combining multiple conditions using Boolean filtering, essential for real-world query building.
Exercise 6: Negation Filtering
Using the ~ operator, return all rows where the grade is not "Pass".
Skill tested: Using negation to refine DataFrame queries — useful when it's easier to define what you don't want.
Exercise 7: Slice a Range of Rows and Columns
Using .loc, select rows 2 through 4 (inclusive) and only the name and score columns.
Skill tested: Inclusive label-based slicing, which behaves differently than typical Python list slicing.
Section 3: Data Cleaning and Wrangling
Exercise 8: Detect Missing Values
Given a DataFrame containing None, NaN, and empty strings, use isna() and notna() to identify which cells are missing.
Skill tested: Recognizing missing data patterns before deciding how to handle them.
Exercise 9: Drop vs. Fill
First, drop all rows containing missing values using dropna(). Then, instead, fill missing numeric values using fillna(df.mean(numeric_only=True)). Compare the two resulting DataFrames.
Skill tested: Understanding the tradeoffs between dropping incomplete data versus imputing values — a decision that directly affects analysis quality.
Exercise 10: Fill with a Constant
Replace all missing values in a "comments" column with the string "N/A" using fillna().
Skill tested: Applying constant-value imputation for non-numeric columns.
Section 4: Grouping and Aggregation
Exercise 11: Group and Summarize
Using a sales dataset with columns product, category, and revenue, group by category and calculate the total revenue per group.
Skill tested: Grouping and aggregating data, a foundational skill for any sales or business analysis report.
Exercise 12: Find the Maximum
From the same sales dataset, find the single most expensive product and print its name and price.
Skill tested: Extracting specific insights from aggregated or sorted data.
Exercise 13: Sort and Rank
Sort your sales DataFrame by revenue in descending order and add a new column showing each product's rank.
Skill tested: Sorting and ranking data, useful for leaderboards, top-performer reports, and prioritization tasks.
Section 5: Data I/O Challenges
Exercise 14: Read and Filter, Then Export
Read a CSV file using pandas.read_csv(), filter it to include only rows meeting a specific condition, and export the filtered result to a new CSV file using to_csv() (without the index column).
Skill tested: A complete real-world workflow — reading, filtering, and exporting data, along with verifying that your output file was written correctly.
Exercise 15: Cross-Format Conversion
Read a JSON file into a DataFrame, inspect it with .info(), and then save it as an Excel file.
Skill tested: Working flexibly across different file formats — CSV, Excel, and JSON — a skill you'll use constantly when integrating with external systems or APIs.
How Did You Score?
If you breezed through all 15 exercises without hesitation, congratulations — you have a solid grasp of core Pandas operations and are likely ready to move into more advanced data science projects involving larger, messier, real-world datasets.
If you found yourself uncertain on filtering logic, confused between .loc and .iloc, or unsure how to handle missing values properly, that's completely normal. These are the exact pain points most learners hit, and they're best solved through structured, guided practice rather than trial and error alone.
Featured Video
[Course video embed placeholder: Pandas Use Cases and Practical Examples]
Level Up With Guided Practice
These exercises are just a sample of the kind of hands-on problem-solving you'll encounter inside Full Stack Python Architect: Flask + React + Vibe Coding. The course dedicates entire lectures to Pandas fundamentals, indexing and filtering, data cleaning and wrangling, data I/O, and practical use cases like student grade analysis and sales reporting — giving you the structured repetition needed to move from "I think I understand this" to "I can build this confidently."
Rather than jumping randomly between tutorials, the course walks you through each concept methodically, then reinforces it with real mini-projects, so skills like grouping, aggregation, and missing-value handling become second nature before you move on to building full-stack applications with Flask and React.
Key Takeaways
- Practice exercises reveal gaps that passive tutorial-watching often hides.
- Filtering, indexing, and grouping are the three pillars of practical Pandas work — master them first.
- Data cleaning (handling
NaN,None, andN/A) is non-negotiable before any real analysis. - File I/O skills (CSV, Excel, JSON) connect your Pandas knowledge to real-world data pipelines.
- If these exercises challenged you, structured, project-based learning can help solidify these skills faster than isolated practice alone.