Skip main navigation

NumPy arrays

Learn what high-performance arrays and matrices are provided in the NumPy library to dramatically speed up the runtime of code.

Throughout this week you have learned about time and space complexities, the data structures of Python, and the implications for time complexities of algorithms and operations that you can perform on these structures.

Another topic to add to our list for writing faster code is NumPy arrays. The NumPy library provides high-performance arrays and matrices that we can use to dramatically speed up the runtime of our code. NumPy uses underlying compiled code (C/C++) to achieve this.

Processing data in a NumPy array is much faster than processing it in a Python list. If you find yourself processing lists of numbers, you should always ask yourself if you could model it as an array and model the processing steps vector/matrix math.

In this video, we will use an example to learn how NumPy can allow you to run faster code.

If you are interested in learning about the NumPy package in more detail, feel free to explore the NumPy docs and tutorials.

Follow along

The file used in this video is Numpy Arrays To The Rescue!.ipynb. Please download this file from the Downloads section below.
Make sure you are able to access it, in order to follow along with the video.

From the examples shown in this step, you got a good idea of why you can use NumPy, and in the next step we will explore some more basics of NumPy.

This article is from the free online

Intermediate Python

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now