user2229953 user2229953 - 7 months ago 30
Python Question

List to array conversion

I have a list in python and I want to convert it to an array to be able to use

ravel()
function.

Answer

Use numpy.asarray:

import numpy as np
myarray = np.asarray(mylist)
Comments