/  Technology   /  Python Lists VS Numpy Arrays
Python Lists VS Numpy Arrays

Python Lists VS Numpy Arrays

NumPy is the essential package for scientific computing in Python. Numpy arrays exhibits advanced mathematical and different types of operations on large numbers of data. Commonly, such operations are run more efficiently and by using Python’s built-in sequence it is possible with less code. NumPy is Python extension module but not another programming language. It offers quick and efficient operations on arrays of homogeneous data.

 

Important things about Numpy arrays:

 

  • We can make N-dimensional array in python using numpy.array().
  • Data inside array must be of same Datatype i.e., Homogeneous.
  • It is possible to perform operations element wise.
  • For easy matrix computation Numpy array has various function, methods, and variables.
  • In memory elements of an array are stored contiguously.

 

Advantages of using Numpy Arrays Over Python Lists:

 

  • consumes less memory.
  • fast as compared to the python List.
  • convenient to use.

 

List:

 

list is a collection of items which are ordered and changeable. In Python, lists are enclosed with in square brackets.

 

Important things about Python Lists:

 

  • The list might be homogeneous or heterogeneous.
  • It is not possible to perform element wise operation on the list.
  • Python list is 1 dimensional by default. Yet we can create an N-Dimensional list.
  • Elements of a list not required to be contiguous in memory.

 

Leave a comment