[Numpy-discussion] Fast way to convert (nested) list to numpy object array?
Julian Taylor
jtaylor.debian at googlemail.com
Thu Jul 3 05:30:33 EDT 2014
numpy descends into the lists even if you request a object dtype as it
treats object arrays containing nested lists of equal size as
ndimensional:
np.array([[1,2], [3,4]], dtype=object).ndim
2
I don't think we have a constructor that limits the maximum dimension,
only one the minimum dimension.
I guess we could add one e.g. np.array(nested_list, dtype=object, ndmax=1)
But I'm not sure if its really worth it, can't you somehow move the
array construction out of your tight loops?
More information about the NumPy-Discussion
mailing list