Introduction: Are Your Pandas Skills Ready for Real-World Data?
If you've spent any time learning Python for data analysis, you've almost certainly crossed paths with Pandas — the powerhouse library that makes working with structured data feel almost effortless. But watching tutorials and actually doing the work are two very different things. The best way to know if you truly understand DataFrames, filtering, and data manipulation is to test yourself with real practice problems.
This article gives you 20 practical Pandas exercises designed to check your data analysis knowledge, whether you're brushing up before a job interview, preparing for a data science course, or simply want to confirm you're ready to move on to more advanced topics. Grab a Jupyter notebook, load up a sample dataset, and let's put your skills to the test.
Why Practice Exercises Matter More Than Passive Learning
Programming — and especially data analysis — is a skill you build through repetition. Reading about the .groupby() method or watching someone filter a DataFrame in a video is helpful, but it doesn't compare to typing the code yourself, hitting an error, and figuring out why. Solid pandas practice exercises force you to:
- Recall syntax without relying on copy-paste
- Understand why a method works, not just that it works
- Build the muscle memory needed for real-world data cleaning tasks
- Identify gaps in your understanding before they become costly mistakes
This is the same philosophy behind strong foundational programming education. Before you can comfortably manipulate DataFrames, you need a rock-solid grasp of Python fundamentals — data types, variables, lists, dictionaries, and control flow. If any of those feel shaky, it's worth reviewing them first, since Pandas is really just Python applied to tabular data.
Section 1: DataFrame Basics (Exercises 1–5)
These first few challenges test whether you understand how to create, inspect, and explore a DataFrame — the foundational skill before any serious analysis begins.
Exercise 1: Create a DataFrame from a Dictionary
Build a DataFrame using a Python dictionary where each key represents a column name and each value is a list of entries. This mirrors how you'd store structured data using core Python collections like lists and dictionaries.
Exercise 2: Inspect the Data
Use .head(), .info(), and .describe() to explore your DataFrame's structure, data types, and summary statistics.
Exercise 3: Check Column Data Types
Identify which columns are stored as integers, floats, strings, or booleans. Understanding data types is just as important in Pandas as it is in plain Python.
Exercise 4: Rename Columns
Practice renaming one or more columns using .rename() without altering the underlying data.
Exercise 5: Select Specific Columns
Select a single column and then a subset of multiple columns using bracket notation.
Section 2: Filtering and Boolean Logic (Exercises 6–10)
Filtering is where comparison and logical operators come into play — the same and, or, and not logic used in basic Python conditionals applies directly to Pandas filtering.
Exercise 6: Filter Rows by a Single Condition
Return all rows where a numeric column (like age or score) is greater than a given threshold.
Exercise 7: Combine Multiple Conditions
Use & and | operators to filter rows matching two or more conditions simultaneously — for example, students older than 18 and scoring above 80.
Exercise 8: Filter Using .isin()
Practice filtering rows where a column's value matches one of several options in a list.
Exercise 9: Filter Text Columns
Use string methods like .str.contains() to filter rows based on partial text matches.
Exercise 10: Combine Filtering with Sorting
Filter a dataset and then sort the results using .sort_values() to display the highest or lowest matching entries first.
Section 3: Data Manipulation Challenges (Exercises 11–15)
Now it's time to actually reshape and transform your data — a critical skill for anyone building reports or preparing datasets for analysis.
Exercise 11: Add a Calculated Column
Create a new column based on existing ones, such as calculating a total price from quantity and unit price — a great callback to basic arithmetic operators like multiplication and addition.
Exercise 12: Apply a Custom Function
Use .apply() to run a custom function across a column, such as assigning letter grades based on numeric scores.
Exercise 13: Handle Missing Values
Identify and fill or drop missing values using .fillna() and .dropna().
Exercise 14: Group and Aggregate Data
Use .groupby() to calculate averages, sums, or counts across categories — for example, finding the class average score.
Exercise 15: Format Output with F-Strings
Practice generating a clean summary report using Python f-strings to display calculated results, such as highest and lowest scores in a class.
Section 4: Advanced Practice (Exercises 16–20)
These final challenges combine everything above into more realistic, multi-step problems.
Exercise 16: Merge Two DataFrames
Practice combining two related datasets using .merge() on a shared key column.
Exercise 17: Pivot Table Creation
Build a pivot table summarizing data across two categorical dimensions.
Exercise 18: Detect and Remove Duplicates
Use .duplicated() and .drop_duplicates() to clean a messy dataset.
Exercise 19: Export Cleaned Data
Practice saving your cleaned and filtered DataFrame to a new CSV file using .to_csv().
Exercise 20: Build a Mini Report
Combine filtering, grouping, and f-string formatting to generate a short, readable summary report — similar to structuring a student grade report with averages, highs, and lows.
How to Know If You Passed the Test
There's no official passing score here — the real goal is honest self-assessment. If you breezed through Exercises 1–10 but stumbled on grouping, merging, or custom functions, that tells you exactly where to focus your next study session. If you struggled with the filtering logic in Section 2, it likely means it's time to revisit Python operators and boolean expressions, since Pandas filtering is really just applied logical thinking.
Featured Video
[Course video embed placeholder]
Building the Foundation Before You Master Pandas
Pandas can feel intimidating if your core Python skills aren't fully solidified first. That's exactly why a strong beginner course matters — one that covers data types, variables, strings, lists, dictionaries, control flow, and functions in a structured, hands-on way. The Python for Beginners course was designed to build exactly this kind of foundation, walking you through practical use cases, real coding logic, and structured exercises — the same skills that make concepts like DataFrame filtering and data manipulation click naturally once you get to Pandas.
If any of the 20 exercises above felt harder than they should have, it might not be a Pandas problem at all — it could simply mean your Python fundamentals need a quick refresh.
Conclusion: Keep Practicing, Keep Building
Testing your Pandas skills isn't about getting a perfect score on the first try — it's about identifying where you stand and building a clear path forward. Revisit the exercises that gave you trouble, experiment with real datasets, and don't be afraid to break things and debug them. That's how real data analysis skill is built.
And if you found yourself needing a refresher on core Python concepts along the way, consider exploring the full Python for Beginners course to strengthen your foundation before diving deeper into Pandas and data science.