Since when did numpy allow you to define an array of python objects? Objects array with numpy.
Is there any fundamental difference between these arrays and a python list?
What is the difference between these arrays and say, a python tuple?
There are several handy numpy functions I would like to use, i.e. masks and element-wise operations, on an array of python objects and I would like to use them in my analysis, but I’m worried about using a feature I can’t find documentation for anywhere. Is there any documentation for this ‘object’ datatype?
Was this feature was added in preparation for merging numpy into the standard library?
The “fundamental” difference is that a Numpy
arrayis fixed-size, while a Pythonlistis a dynamic array.(You can get around this with
numpy.concatenate, but still Numpy arrays aren’t meant as a drop-in replacement forlist.)Arrays of
objectare perfectly well documented, but be aware that you’ll have to passdtype=objectsometimes: