[Collection] 10 Best NumPy Cheat Sheets Every Python Coder Must Own

Little time to learn NumPy? This article shows you the 10 most amazing NumPy cheat sheets. Download them, print them, and pin them to your wall — and watch your data science skills grow!

(Click to download PDF)

All NumPy cheat sheets in this article are 100% free. Here’s a quick summary if you don’t have time reading all cheat sheets:

NumPy is a widely used Python scientific computing package. It simplifies linear algebra, matrix computations, and speeds up data analysis. Knowing NumPy is a prerequisite for other Python packages like pandas or Scikit-Learn.

This article should serve as the ultimate NumPy reference. The cheat sheets are diverse and range from one page to multiple pages. They also involve cross-language comparison cheat sheets. Some resources would be a great beginner’s reference. The others are involved and require high-level expertise.

1. Basic NumPy Cheat Sheet

This is a useful resource for the NumPy basics. It provides a summary of creating arrays and some basic operations. It is minimalistic, with a good overview of many basic functions. The sheet is divided into sections with headers for easier orientation. On the left-hand side of the sheet, the NumPy import convention is mentioned import numpy as np. Each function is followed by a one-line explanation. The biggest advantage of this list is good readability. This enables a quick search for the right function.

2. DataCamp NumPy Basics Cheat Sheet

DataCamp is an online platform that offers data science training through videos and coding exercises. This cheat sheet is one of the most comprehensive one-page cheat sheets available. In a way, it adds to the previous cheat sheet with more examples and more functions. It is a good summary of creating arrays and basic array design. This cheat sheet provides functions for the specific datatypes. At the end of the sheet are more advanced stuff like slicing and indexing. There are also some introductory tools for data analysis and array manipulation. Though overall, this is an amazing resource, the one drawback is the color palette. The bright orange is a distraction from the content. If you like the color palette, this could be your go-to comprehensive list of the NumPy basics.

3. A Little Bit of Everything Cheat Sheet

The cheat sheet is divided into four parts. The first part goes into details about NumPy arrays, and some useful functions like np.arrange or finding the number of dimensions. The 2nd part focuses on slicing and indexing, and it provides some nice examples of Boolean indexing. The last two columns are a little bit disconnected. They provide a wide range of functions, ranging from matrix operations like transpose to sorting an array. However, the last two columns are not necessarily grouped conveniently. The advantage of this sheet is that it also includes Booleans, not only the numerical types.

4. Data Science Cheat Sheet

Dataquest is a similar online platform to DataCamp. It offers a variety of data science tracks and lessons, followed by coding exercises. This is another good resource of the most important NumPy functions and properties. The cheatsheet is readable with distinguishable sections, and each section has a clear title. Besides the sheet organization and excellent readability, it provides a range of functions and operations. Also, compared to the previous two cheat sheets, there is a math and statistics section. It divides the math sections into scalar and vector math and there is a statistics section at the bottom.

5. NumPy Cheat Sheet for Matlab users

If you are a Matlab user and need a quick introduction to Python and Numpy this could be your go-to. The sheet contains 3 columns – the first column is the Matlab/Octave, the second column are the Python and NumPy equivalents, and the third is a description column. The sheet’s focus is not solely on NumPy, but there are many Python basics listed. Since it is not a single sheet, the content is organized into separate sections. It provides math, logical and boolean operators, roots and round offs, complex numbers, extensive linear algebra, reshaping and indexing, some basic plots, calculus, and statistics.

6. The Matrix Cheat Sheet

This cheat sheet provides the equivalents for 4 different languages – MATLAB/Octave, Python and NumPy, R, and Julia. The list is not a single pdf sheet, but it is a scrollable document. On each far left-hand and the right-hand side of the document, there are task descriptions. This is an extensive sheet, and it is extra useful because the output of each task is given. The sheet covers creating and designing of matrices, matrix shape manipulation, and some basic and more advanced matrix operations. The advanced section is particularly interesting because it lists many useful functions in data analysis like finding a covariance and eigenvalues and creating random normally distributed variables.

7. Numerical Analysis Cheat Sheet

This is the most comprehensive sheet on the list. Not only that includes side-to-side equivalents between MATLAB, R, NumPy and Julia, it also covers everything from functions and syntax, to loops and I/O. The most interesting and useful component is that certain lines like a function definition are given for MATLAB, R, and Julia, but not for NumPy because of the lack of that functionality. That makes it easy to compare and contrast and to find the best fit for a project.

8. NumPy Cheat Sheet for R(and S-plus) Users

Although there are other comparison cheatsheets in this collection, this one lists some advanced features. As the title says, it is a comparison between R(and S-plus) and NumPy. It is very detailed for each family of operations. For example, the sorting section provides eight ways to sort an array. Some operations are not possible in both languages, so it is easy to find the right function. This is the only cheat sheet in the collection, that provides detailed plots and graphs. Moreover, some advanced math and statistics were given, like differential equations and Fourier analysis.

9. Scientific Python Cheat Sheet

This is not a NumPy specific sheet. It covers many Python data science topics, but also some Python basics. It is easily navigated through because of the contents given in the beginning. The NumPy section is comprehensive. It covers NumPy basics like the array properties and operations. Also, it contains an extensive list of math functions and linear algebra functions. Some of the useful linear algebra functions are finding inner and outer products and eigenvalues. Others are functions for rounding off and generating random variables.

10. Finxter NumPy Cheat Sheet

The Finxter cheatsheet is different than all the previously mentioned sheets because it is visually the clearest, it gives a detailed description of each function and it lists the examples along with the outcome. The good thing about the visible outcome is that if you were unsure about the name of the function, looking at the outcome can help. Along with the cheat sheet, there is an accompanying video with further detailed examples and explanations.

Bonus Cheat Sheet: From NumPy to xtensor

xtensor is a C++ library, similar to NumPy, made for numerical analysis. The cheat sheet provides a two-column view, where the first column is NumPy and the second column are the xtensor equivalents. The sheet focuses on array initialization, reshaping and slicing functions. Further, it continues with array manipulation like transpose or rotation functions. There is a good amount of tensor operations. The sheet is missing the descriptions, so is not always easily deducible what a certain function does.


This article is contributed by Finxter user Milica Cvetkovic. Thanks for the thorough and detailed work, Milica! 🐍 Milica is also a writer on Medium — check out her Medium Profile.

Where to Go From Here?

A thorough understanding of the NumPy basics is an important part of any data scientist’s education. NumPy is at the heart of many advanced machine learning and data science libraries such as Pandas, TensorFlow, and Scikit-learn.

If you struggle with the NumPy library — fear not! Become a NumPy professional in no time with our new coding textbook “Coffee Break NumPy”. It’s not only a thorough introduction into the NumPy library that will increase your value to the marketplace. It’s also fun to go through the large collection of code puzzles in the book.

Get your Coffee Break NumPy!

Leave a Comment

Your email address will not be published. Required fields are marked *