Program to convert an array into a list using NumPy.

In this python numpy program, we will convert an array into a list using NumPy.

Steps to solve the program
  1. Import the numpy library as np.
  2. Create an array using np.array().
  3. Convert an array into a list using tolist() and store the result in a variable.
  4. Print the output.
				
					import numpy as np
x = np.array([[3,0],
             [6,4]])
print("Matrix: \n",x)
y = x.tolist()
print("List: ",y)
				
			

Output :

				
					Matrix: 
 [[3 0]
 [6 4]]
List:  [[3, 0], [6, 4]]
				
			

convert the list into an array.

find the missing data in a given array.

Leave a Comment