A Professional’s Tutorial to Python Numpy

Lists • arrays Compare + contrast fundamental Python data types

Adam Ross Nelson
8 min readSep 17

For an overview of these tutorials, click here (or click the image).

Welcome to tenth, in a series of tutorials that teach beginner Python specifically for aspiring data scientists. For an overview of these tutorials, click here.

Introduction

So you might be tempted to ask yourself why is Python so popular for data science? There are a variety of reasons for that. And as discussed in the introductory article on this tutorial series popularity is also a mixed blessing.

So yeah, Python’s rise in data science has been meteoric. Python owes much this rise to its simplicity and expansive library repertoire. At the forefront of these libraries stands NumPy, which offers nearly unparalleled capabilities for handling arrays and intricate numerical computations.

White background with black numbers strewn across the image. Many small and large numbers.
Image Credit: Author’s illustration created in Canva.com.

Earlier tutorials in this series introduced readers to Python lists.

After having studied more rudimentary data types, such as lists, it is also important to study arrays and matrices which are not native to Python. One of the best ways to learn about arrays is to focus on the data structure as provided by NumPy and also to explore arrays by comparing them with lists.

If you have already learned how to work with Python lists, this tutorial will teach you how to further enhance your skills by learning, understanding, and working with arrays and matrices.

Abstract

This tutorial contrasts Python’s basic lists and embedded lists with NumPy arrays and matrices. While lists are flexible and can store varied data types, they often unnecessarily drain computational resources due to dynamic type-checking and are not memory efficient. This “unnecessarily drain computational resources” lingo is a diplomatic way of saying lists are inefficient.

NumPy arrays, on the other hand, are uniform in data type, allowing for better computational efficiency and optimal memory usage.

Adam Ross Nelson

Ask about my free career course. I mentor new (💫) and aspiring data scientists enter (🚪) and level up (📈) in the field.