Friday 13:30–15:00 in Tower Suite 2

Making computation easier with cool Numpy tricks

Kirit Thadaka

Audience level:


Numpy is a premier scientific computing library that can turn any problem into a piece of cake if used correctly. It is highly optimized to give you all the functionality you need without having to compromise on performance. In this tutorial I will take you through some of the more powerful Numpy functions that will help you solve your problems better and in fewer lines of code.


I will start off this tutorial by quickly going over the oh so important, ND Array. I will then talk about indexing and broadcasting as they are features that make Numpy unique. Once this short introduction is done, I will get into the more advanced Numpy features. I will try to cover as many of the following topics

Ufuncs in Numpy

Stride tricks is one of my favourite Numpy features and I will show you how to do clever things with this like applying a sliding window to your array and convolution operations in a few lines of code.

Einsum is a powerful function that gives you the ability to implement Einstein summation techniques on your arrays.

I will talk about how to subclass numpy arrays as this is useful to know if you're ever creating your own libraries that leverage Numpy capabilities.

In addition to this, I will show you cool ways to draw shapes like circles or ellipses inside a Numpy array using masks and I will introduce you to the Numpy mesh function np.ix_.

For those of you who generally work with large data sets, you'll find that loading/saving your data into files can be a performance bottleneck and sometimes infeasible. I will introduce Memory mapped files and show you how you can work with large files without compromising on performance.

I will take you through each of these functions and talk about how they can help you and how they have helped me with some of my projects.

This will be an interactive tutorial where the focus will be on attendees getting hands on experience with these Numpy features so that they can use them in their projects.

Subscribe to Receive PyData Updates