Answers for "converting np array to list"

12

ndarray to list

a = np.array([1, 2])
a.tolist()
Posted by: Guest on April-06-2020
0

list of list to numpy array

>>> lists = [[1, 2], [3, 4]]
>>> np.array(lists)
array([[1, 2],
       [3, 4]])
Posted by: Guest on March-02-2021

Python Answers by Framework

Browse Popular Code Answers by Language