I have an array of NumPy (lengths X) arrays, all of which are of the same length (Y), but are of type โobjectโ and therefore have dimension (X,). I would like to "convert" this to a dimension array (X, Y) with the member type of the member arrays ("float").
The only way I can do this is by hand with something like
[x for x in my_array]
Is there a better idiom for doing this โconversionโ?
For example, I have something like:
array([array([ 0., 0., 1., 0., 0., 0., 0., 0., 0., 0.]),
array([ 0., 1., 0., 0., 0., 0., 0., 0., 0., 0.]),
array([ 0., 0., 1., 0., 0., 0., 0., 0., 0., 0.]), ...,
array([ 0., 0., 0., 0., 0., 0., 0., 0., 0., 1.]),
array([ 0., 0., 0., 0., 0., 0., 0., 1., 0., 0.]),
array([ 0., 0., 0., 0., 0., 0., 0., 0., 0., 1.])], dtype=object)
which has shape(X,), not (X, 10).