Closed
Description
When accessing multiple fields of a structured array, numpy fails to verify that all the fields exist. Instead, it will only return existing fields. If none exist, it return a strange object that has a dtype that is empty. Normally, creating an object with an empty dtype is not supposed to be possible (zeros(shape=(5,), dtype=[])
results as expected in TypeError: Empty data-type
), so this might actually be a dual bug.
In [216]: A = numpy.empty(dtype=[("A", "f4"), ("B", "f8")], shape=(5,))
In [217]: A[["AA"]]
Out[217]:
array([(), (), (), (), ()],
dtype='{'names':[], 'formats':[], 'offsets':[], 'itemsize':12}')
In [232]: A[["AA", "B"]]
Out[232]:
array([(0.0,), (0.0,), (0.0,), (0.0,), (0.0,)],
dtype=[('B', '<f8')])
Metadata
Metadata
Assignees
Labels
No labels