100 Pandas Puzzles

100 data puzzles for pandas, ranging from short and simple to super tricky (60% complete)
Alternatives To 100 Pandas Puzzles
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
100 Pandas Puzzles1,977
2 months ago11mitJupyter Notebook
100 data puzzles for pandas, ranging from short and simple to super tricky (60% complete)
Datasciencegym6
5 years agomitJupyter Notebook
A series of little puzzles and training exercises aimed at improving python knowledge for data science
Chessboard4
4 years ago9gpl-2.0Python
:game_die: CLI to solve combinatoric chess puzzles.
Strategic Test Suite2
3 months agomitPython
Strategic Test Suite
100 Pandas Puzzles Cn1
3 years agomitJupyter Notebook
Pandas 循序渐进一百题(60% 已完成)
100_pandas_exercises1
5 years agoJupyter Notebook
100 mini-exercises to develop fluency in Pandas
Pandasprojects1
5 years agogpl-3.0Jupyter Notebook
Solving 100 pandas puzzles to improve proficiency in pandas
Pandas1001
4 years agomitJupyter Notebook
Pandas_puzzles1
3 years agomitJupyter Notebook
Alternatives To 100 Pandas Puzzles
Select To Compare


Alternative Project Comparisons
Readme

100 pandas puzzles

Puzzles notebook

Solutions notebook

Inspired by 100 Numpy exerises, here are 100* short puzzles for testing your knowledge of pandas' power.

Since pandas is a large library with many different specialist features and functions, these excercises focus mainly on the fundamentals of manipulating data (indexing, grouping, aggregating, cleaning), making use of the core DataFrame and Series objects. Many of the excerises here are straightforward in that the solutions require no more than a few lines of code (in pandas or NumPy - don't go using pure Python!). Choosing the right methods and following best practices is the underlying goal.

The exercises are loosely divided in sections. Each section has a difficulty rating; these ratings are subjective, of course, but should be a seen as a rough guide as to how elaborate the required solution needs to be.

Good luck solving the puzzles!

* the list of puzzles is not yet complete! Pull requests or suggestions for additional exercises, corrections and improvements are welcomed.

Overview of puzzles

Section Name Description Difficulty
Importing pandas Getting started and checking your pandas setup Easy
DataFrame basics A few of the fundamental routines for selecting, sorting, adding and aggregating data in DataFrames Easy
DataFrames: beyond the basics Slightly trickier: you may need to combine two or more methods to get the right answer Medium
DataFrames: harder problems These might require a bit of thinking outside the box... Hard
Series and DatetimeIndex Exercises for creating and manipulating Series with datetime data Easy/Medium
Cleaning Data Making a DataFrame easier to work with Easy/Medium
Using MultiIndexes Go beyond flat DataFrames with additional index levels Medium
Minesweeper Generate the numbers for safe squares in a Minesweeper grid Hard
Plotting Explore pandas' part of plotting functionality to see trends in data Medium

Setting up

To tackle the puzzles on your own computer, you'll need a Python 3 environment with the dependencies (namely pandas) installed.

One way to do this is as follows. I'm using a bash shell, the procedure with Mac OS should be essentially the same. Windows, I'm not sure about.

  1. Check you have Python 3 installed by printing the version of Python:
python -V
  1. Clone the puzzle repository using Git:
git clone https://github.com/ajcr/100-pandas-puzzles.git
  1. Install the dependencies (caution: if you don't want to modify any Python modules in your active environment, consider using a virtual environment instead):
python -m pip install -r requirements.txt
  1. Launch a jupyter notebook server:
jupyter notebook --notebook-dir=100-pandas-puzzles

You should be able to see the notebooks and launch them in your web browser.

Contributors

This repository has benefitted from numerous contributors, with those who have sent puzzles and fixes listed in CONTRIBUTORS.

Thanks to everyone who has raised an issue too.

Other links

If you feel like reading up on pandas before starting, the official documentation useful and very extensive. Good places get a broader overview of pandas are:

There are may other excellent resources and books that are easily searchable and purchaseable.

Popular Pandas Projects
Popular Puzzle Projects
Popular Data Processing Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Python
Jupyter Notebook
Pandas
Numpy
Data Analysis
Puzzle
Medium
Dataframe