Q:

Write a NumPy program to convert a NumPy array into Python list structure

0

Write a NumPy program to convert a NumPy array into Python list structure.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import numpy as np
x= np.arange(6).reshape(3, 2)
print("Original array elements:")
print(x)
print("Array to list:")
print(x.tolist())

Sample Output:

Original array elements:                                                               
[[0 1]                                                                                 
 [2 3]                                                                                 
 [4 5]]                                                                                
Array to list:                                                                         
[[0, 1], [2, 3], [4, 5]]

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now