Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] loc indexing with length-1 Categorical not possible #13014

Open
Tracked by #12793
wence- opened this issue Mar 27, 2023 · 0 comments · May be fixed by #13717
Open
Tracked by #12793

[BUG] loc indexing with length-1 Categorical not possible #13014

wence- opened this issue Mar 27, 2023 · 0 comments · May be fixed by #13717
Assignees
Labels
bug Something isn't working improvement Improvement / enhancement to an existing function Python Affects Python cuDF API.

Comments

@wence-
Copy link
Contributor

wence- commented Mar 27, 2023

Describe the bug

import cudf
import pandas as pd
f = pd.Series([1, 2, 3], index=pd.CategoricalIndex([0, 1, 2]))
f.loc[pd.Categorical([1])] # => second row.
cf = cudf.from_pandas(f)
cf.loc[pd.Categorical([1])] # => KeyErrror

I think this is similar to #13013 in that length-one categoricals are treated as scalars in some cases.

Expected behavior

Probably this lookup should work.

@wence- wence- added bug Something isn't working Needs Triage Need team to review and classify labels Mar 27, 2023
@wence- wence- self-assigned this May 2, 2023
@wence- wence- added Python Affects Python cuDF API. improvement Improvement / enhancement to an existing function and removed Needs Triage Need team to review and classify labels May 2, 2023
@wence- wence- linked a pull request Jul 18, 2023 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working improvement Improvement / enhancement to an existing function Python Affects Python cuDF API.
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

1 participant