Constructing your array - simple copy-n-paste won't do it:
In [467]: a = np.array([None,None])
In [468]: a[:] = [1,2,3],[4,5,6]
In [469]: a
Out[469]: array([list([1, 2, 3]), list([4, 5, 6])], dtype=object)
YOur failed attempt, with full traceback:
In [471]: np.asarray(a, dtype=np.float32)
TypeError: float() argument must be a string or a number, not 'list'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<ipython-input-471-a8170ed9d2a8>", line 1, in <module>
np.asarray(a, dtype=np.float32)
ValueError: setting an array element with a sequence.
It's still trying to turn the 2 element object array into a 2 element float.
A working way:
In [472]: np.stack(a)
Out[472]:
array([[1, 2, 3],
[4, 5, 6]])
another
In [473]: a.tolist()
Out[473]: [[1, 2, 3], [4, 5, 6]]
In [474]: np.array(a.tolist())
Out[474]:
array([[1, 2, 3],
[4, 5, 6]])
np.array? Also, what input are you using to cast to numpy?asarraydoesn't work, why wouldarray?