np array from a list code example
Example 1: np.array to list
>>> a = np.array([1, 2])
>>> list(a)
[1, 2]
>>> a.tolist()
[1, 2]
Example 2: numpy array from list
>>> a = [1, 2]
>>> np.asarray(a)
array([1, 2])
>>> a = np.array([1, 2])
>>> list(a)
[1, 2]
>>> a.tolist()
[1, 2]
>>> a = [1, 2]
>>> np.asarray(a)
array([1, 2])