Skip to content

Axis order from "fancy" indexing with dask.array does not match NumPy #7313

Open

Description

@shoyer

This indexing operations from Dask and NumPy should result in arrays with the same shape:

import dask.array as da
import numpy as np

print(np.ones((2, 3, 4))[0, :, [0, 1]].shape)  # (2, 3)
print(da.ones((2, 3, 4))[0, :, [0, 1]].shape)  # (3, 2)

This is the "Combing advanced and basic indexing" case from NumPy: https://numpy.org/doc/stable/reference/arrays.indexing.html#combining-advanced-and-basic-indexing

It's also the same counter-intuitive example from NEP-21: https://numpy.org/neps/nep-0021-advanced-indexing.html#mixed-indexing

It would be best to fix this inconsistency, or to raise an error pointing users to vindex.

Note: this is somewhat related to but distinct from #4157

Environment:

  • Dask version: 2.12.0

Activity

  1. ncclementi commented on Aug 11, 2021

    @ncclementi
    Member

    Retested and this issue still persists on Dask 2021.07.2,
    @shoyer Would you like to take a crack at this?

  2. shoyer commented on Aug 11, 2021

    @shoyer
    MemberAuthor
  3. added
    needs attentionIt's been a while since this was pushed on. Needs attention from the owner or a maintainer.
    on Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    arrayneeds attentionIt's been a while since this was pushed on. Needs attention from the owner or a maintainer.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions