Python Numpy

Overview & Getting started

Keno Leon
4 min readAug 14, 2020

--

What is it ?

If you work or are learning python, sooner or later you will bump into Numpy arrays, I’d venture that numpy, along with pandas dataframes are the workhorses of data as far as python is concerned. In layman terms Numpy arrays are data containers that can represent multiple dimensions and be queried and operated on, or if you prefer the official definition from the docs:

NumPy’s main object is the homogeneous multidimensional array. It is a table of elements (usually numbers), all of the same type, indexed by a tuple of non-negative integers. In NumPy dimensions are called axes.

From lists to Numpy Arrays

You might be familiar with python lists :

list = [1,2,3,4,5,6]
print(list)
>>>
[1, 2, 3, 4, 5, 6]

Well, a Numpy array at first glance is a very similar concept:

import numpy as npnp_array = np.array([1, 2, 3, 4, 5, 6])
print(np_array)
>>>
[1 2 3 4 5 6]

Do note the lack of commas which tell us we are dealing with something different than a regular list.

SideNote: Why use Numpy ? : Because it is faster than a regular list and because

--

--