explaingit

rougier/numpy-100

14,108PythonAudience · dataComplexity · 2/5LicenseSetup · easy

TLDR

A collection of 100 hands-on NumPy exercises with solutions for practicing numerical computing in Python, useful as a self-study course, a quick reference, or ready-made classroom material.

Mindmap

mindmap
  root((numpy-100))
    Content
      100 exercises
      Solutions included
      Varying difficulty
    How to use
      Run on Binder
      Read on GitHub
      Local Jupyter notebook
    Audience
      Beginners learning NumPy
      Experienced users
      Teachers and students
    Contributing
      Keyed text source file
      Python generation script
      Markdown and notebook output
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Work through 100 progressively challenging exercises to build NumPy skills from scratch.

USE CASE 2

Use the exercise set as ready-made course material for a Python data science class.

USE CASE 3

Run the exercises interactively in a browser via Binder with no local installation required.

USE CASE 4

Use the collection as a quick reference cheat sheet for common NumPy operations and patterns.

Tech stack

PythonNumPyJupyter

Getting it running

Difficulty · easy Time to first run · 5min

Can run interactively in-browser via Binder, local use requires Python and NumPy installed.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

This repository is a set of 100 practice exercises for NumPy, a widely used add-on library for the Python programming language. NumPy is the standard tool for working with numbers in bulk, such as large tables and grids of data, and it is a foundation for much of the data science and scientific computing done in Python. The exercises are meant to help people learn and practice it through small, concrete problems. The author gathered the problems from several sources, including the NumPy mailing list, the question-and-answer site Stack Overflow, and the official NumPy documentation, then wrote some additional problems to round the collection out to one hundred. According to the README, the collection has two purposes: to act as a quick reference for both new and experienced users, and to give teachers a ready-made set of exercises to use with students. The exercises come with solutions. There are a few ways to use the material. You can run the exercises interactively in your browser through a service called Binder, which sets up a working environment for you without any installation, or you can simply read them as a document on GitHub. For people who want to go further, the README links to a longer companion text called From Python to NumPy. The README also explains how the project is put together for anyone who wants to contribute. The exercise content is not edited directly in the finished files. Instead, the source text lives in a single file written in a simple key-and-value format the author calls keyed text, and a Python script then generates both the Markdown version and the notebook version from that source. To change an exercise, you edit the source file and rerun that script. The work is released under the MIT license, and the README notes that a separate version of the exercises exists for the Julia programming language.

Copy-paste prompts

Prompt 1
I'm working through numpy-100 exercise #42. Give me a hint for how to extract all non-zero elements from a NumPy array without using a loop.
Prompt 2
Using numpy-100 solutions as a reference, show me the most efficient way to normalize a 2D NumPy array to the range 0 to 1 row by row.
Prompt 3
Generate a 5-question NumPy quiz in the style of numpy-100, focusing on array indexing and boolean masking.
Prompt 4
I'm teaching a Python data science intro course. Which 15 exercises from numpy-100 are best suited for complete beginners who have never used arrays before?
Open on GitHub → Explain another repo

← rougier on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.