Numpy Array vs. Python Lists

  • September 27, 2018
  • by

Numpy Array vs. Python Lists

Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Numpy is the core library for scientific computing in Python. It provides a high-performance multidimensional array object, and tools for working with these arrays. A numpy array is a grid of values, all of the same type, and is indexed by a tuple of non-negative integers. The number of dimensions is the rank of the array; the shape of an array is a tuple of integers giving the size of the array along each dimension.

The Python core library provided Lists. A list is the Python equivalent of an array, but is resizeable and can contain elements of different types.


The main benefits of using NumPy arrays should be smaller memory consumption and better runtime behavior.

NumPy takes up less space. This means that an arbitrary integer array of length “n” in numpy needs

96 + n * 8 Bytes

whereas a list of integer

So the more numbers you need to store – the better you do.

For Python Lists – We can conclude from this that for every new element, we need another eight bytes for the reference to the new object. The new integer object itself consumes 28 bytes. The size of a list “lst” without the size of the elements can be calculated with:

64 + 8 * len(lst) + + len(lst) * 28

You may also Like

Leave a reply

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

About Me

I am a dad of two wonderful boys, Utku Efe and Omer Eren, and married with Elif. In addition, I am an academician and AI/ML scientist because I worked more than 15 years in universities, have M.S and Ph.D. thesis and more than 20 scientific papers/presentations and 100 citations. Now people call me as a Principal Developer in my last company :).
I am really hungry on learning new technologies and get more fun while developing new softwares.

Stay Connected