Skip to content

numpy.void and numpy.ma.mvoid with structured dtypes should support indexing with multiple fields #7262

Closed
@gerritholl

Description

@gerritholl

A structured ndarray can be indexed with multiple fields:

In [14]: X = numpy.empty(shape=1, dtype="(2)3S,(2)3U")

In [15]: X[["f0","f1"]]
Out[15]: 
array([([b'', b''], ['', ''])], 
      dtype=[('f0', 'S3', (2,)), ('f1', '<U3', (2,))])

However, the corresponding numpy.void type cannot:

In [16]: X[0][["f0","f1"]]
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-16-4f230bb69b0d> in <module>()
----> 1 X[0][["f0","f1"]]

IndexError: invalid index

The same is true for masked arrays.

For consistently, numpy.void with a structured dtype should support indexing with multiple fields exactly like numpy.ndarray does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions