Closed
Description
Is the following behaviour of numpy (v1.13.1) a bug or by design?
>>>import numpy as np
>>>a = np.zeros((1,), dtype=[(('title 1', 'x'), '|i1'), (('title 2', 'y'), '>f4')])
>>>a.dtype.descr
[(('title 1', 'x'), '|i1'), (('title 2', 'y'), '>f4')]
>>>a[['y','x']].dtype.descr
[('y', '>f4'), ('x', '|i1')]
I would have expected the last expression to have returned this instead:
[(('title 2', 'y'), '>f4'), (('title 1', 'x'), '|i1')]
Why are the field-titles missing on a view obtained by indexing?
It is kind of surprising, that some aspects of the structured-array dtype just get dropped.
Metadata
Metadata
Assignees
Labels
No labels