How to convert Numpy Array into List in Python?

Convert Numpy Array into List

To convert a Numpy Array into List in Python, call numpy.tolist() function and pass the numpy array as argument to this function.

The syntax to call numpy.tolist() to convert a numpy array into list is


where arr is a numpy array.

Return Value

numpy.tolist() returns an object of type list.

Example 1

In this example, we take a numpy array in arr, and convert this numpy array into list using numpy.tolist().

Python Program

import numpy

arr = numpy.array([[1, 2], [3, 4]])
x = arr.tolist()

print("Numpy Array :\n", arr)
print("List :", x)


Numpy Array :
 [[1 2]
 [3 4]]
List : [[1, 2], [3, 4]]


In this Numpy Tutorial of Python Examples, we learned how to convert a list into a numpy array, with the help of example program.