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] groupby.get_group raises KeyError #17650

Closed
MarcoGorelli opened this issue Dec 21, 2024 · 0 comments · Fixed by #17653
Closed

[BUG] groupby.get_group raises KeyError #17650

MarcoGorelli opened this issue Dec 21, 2024 · 0 comments · Fixed by #17653
Assignees
Labels
bug Something isn't working Python Affects Python cuDF API.

Comments

@MarcoGorelli
Copy link
Contributor

MarcoGorelli commented Dec 21, 2024

Describe the bug
A clear and concise description of what the bug is.

Steps/Code to reproduce bug
Follow this guide http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports to craft a minimal bug report. This helps us reproduce the issue you're having and resolve the issue more quickly.

df = cudf.DataFrame({'b': [4,5], 'a': [1,2], 'c': [4,3]})
df.groupby(['b', 'c']).get_group((4, 4))

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[13], line 2
      1 df = cudf.DataFrame({'b': [4,5], 'a': [1,2], 'c': [4,3]})
----> 2 df.groupby(['b', 'c']).get_group((4, 4))

File /opt/conda/lib/python3.10/site-packages/cudf/utils/performance_tracking.py:51, in _performance_tracking.<locals>.wrapper(*args, **kwargs)
     43 if nvtx.enabled():
     44     stack.enter_context(
     45         nvtx.annotate(
     46             message=func.__qualname__,
   (...)
     49         )
     50     )
---> 51 return func(*args, **kwargs)

File /opt/conda/lib/python3.10/site-packages/cudf/core/groupby/groupby.py:487, in GroupBy.get_group(self, name, obj)
    485         name = name[0]
    486     else:
--> 487         raise KeyError(name)
    488 return obj.iloc[self.indices[name]]

KeyError: (4, 4)

Expected behavior
A clear and concise description of what you expected to happen.

pandas:

import pandas as pd
df = pd.DataFrame({'b': [4,5], 'a': [1,2], 'c': [4,3]})
df.groupby(['b', 'c']).get_group((4, 4))
 	b 	a 	c
0 	4 	1 	4

Environment overview (please complete the following information)

  • Environment location: [Bare-metal, Docker, Cloud(specify cloud provider)]
  • Method of cuDF install: [conda, Docker, or from source]
    • If method of install is [Docker], provide docker pull & docker run commands used

cudf 24.12.00

spotted in Narwhals

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

Looks like this is due to #17216

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Python Affects Python cuDF API.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants