NVIDIA / NVIDIA/cudf

[BUG] LocIndexing a MultiIndex with a lists does not select all matching level

Open
#13,866 0 comments 0 reactions 0 assignees View on GitHub
bug Python
Dominant language
C++
Stars
9.8k
Forks
1.1k
Avg merge
3d 6m
Merged PRs (30d)
278

Description

**Describe the bug**
LocIndexing a MultiIndex with a lists does not select all matching level

**Steps/Code to reproduce bug**
```
In [19]: import cudf

In [20]: cudf.__version__
Out[20]: '23.10.00'

In [21]: s = cudf.Series(
...:
...: [1, 2, 3, 4, 5, 6],
...:
...: index=cudf.MultiIndex.from_product([["A", "B"], ["c", "d", "e"]]),
...:
...: )

In [22]: s
Out[22]:
A c 1
d 2
e 3
B c 4
d 5
e 6
dtype: int64

In [23]: s.loc[(["A", "B"], ["c", "d"])]
Out[23]: 1

In [24]: s.to_pandas().loc[(["A", "B"], ["c", "d"])]
Out[24]:
A c 1
d 2
B c 4
d 5
dtype: int64
```
**Expected behavior**
When specifying a tuple of lists, the lists select the matching labels in each level. It appears only the first matching label in each level was selected

**Environment overview (please complete the following information)**
- Environment location: Bare-metal
- Method of cuDF install: conda
- If method of install is [Docker], provide `docker pull` & `docker run` commands used

**Environment details**
Please run and paste the output of the `cudf/print_env.sh` script here, to gather any other relevant environment details

**Additional context**
Add any other context about the problem here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.