-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
dask.array.choose() fails when the choice is trivial #11980
Copy link
Copy link
Closed
Labels
needs triageNeeds a response from a contributorNeeds a response from a contributor
Description
Describe the issue:
If dask.array.choose() is used in the trivial case where there is only one choice, it returns NotImplemented. This behavior differs from Numpy's version, which keeps working just fine in this case (see example below).
Minimal Complete Verifiable Example:
import numpy as np
import dask.array as da
indices = np.array([0, 0, 0, 0])
choices = (np.array([10., 20., 30., 40.]),)
print(np.choose(indices, choices))
indices = da.array([0, 0, 0, 0])
choices = (da.array([10., 20., 30., 40.]),)
print(da.choose(indices, choices))The Numpy portion prints the correct result ([10., 20., 30., 40.]), but the Dask portion prints NotImplemented.
Anything else we need to know?:
This example may seem useless, but this originally came up in a context where the number of choices is dynamic, and it is important to retain the correct behavior when there is only one choice.
Environment:
- Dask version: 2025.5.1
- Python version: Python 3.12
- Operating System: Ubuntu 24.04
- Install method (conda, pip, source): conda
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
needs triageNeeds a response from a contributorNeeds a response from a contributor