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] Incorrect output type for MultiIndex.codes #14084

Closed
galipremsagar opened this issue Sep 12, 2023 · 0 comments
Closed

[BUG] Incorrect output type for MultiIndex.codes #14084

galipremsagar opened this issue Sep 12, 2023 · 0 comments
Assignees
Labels
bug Something isn't working Python Affects Python cuDF API.

Comments

@galipremsagar
Copy link
Contributor

Describe the bug
cudf.MultiIndex.codes returns a dataframe, whereas pandas.MultiIndex.codes returns a list of arrays.

Steps/Code to reproduce bug

In [1]: import cudf

In [2]: midx = cudf.MultiIndex(
   ...:         levels=[[1, 3, 4, 5], [1, 2, 5]],
   ...:                 codes=[[0, 0, 1, 2, 3], [0, 2, 1, 1, 0]],
   ...:                         names=["x", "y"],
   ...:                             )

In [3]: midx.codes
Out[3]: 
   0  1
0  0  0
1  0  2
2  1  1
3  2  1
4  3  0

In [4]: midx.to_pandas().codes
Out[4]: FrozenList([[0, 0, 1, 2, 3], [0, 2, 1, 1, 0]])

In [5]: midx.to_pandas().codes[0]
Out[5]: array([0, 0, 1, 2, 3], dtype=int8)

In [6]: midx.to_pandas().codes[1]
Out[6]: array([0, 2, 1, 1, 0], dtype=int8)

Expected behavior
Match pandas by returning a list of cupy arrays.

Environment overview (please complete the following information)

  • Environment location: [Bare-metal]
  • Method of cuDF install: [from source]
@galipremsagar galipremsagar added bug Something isn't working Python Affects Python cuDF API. labels Sep 12, 2023
@galipremsagar galipremsagar self-assigned this Sep 12, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in cuDF/Dask/Numba/UCX Oct 9, 2023
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
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant