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

[FEA] cudf.DataFrame.mean doesn't work for MultiIndex #15085

Closed
amanlai opened this issue Feb 19, 2024 · 0 comments · Fixed by #15097
Closed

[FEA] cudf.DataFrame.mean doesn't work for MultiIndex #15085

amanlai opened this issue Feb 19, 2024 · 0 comments · Fixed by #15097
Assignees
Labels
bug Something isn't working Python Affects Python cuDF API.

Comments

@amanlai
Copy link

amanlai commented Feb 19, 2024

Suppose I have a cudf DataFrame as follows:

df = cudf.DataFrame({('a', 1): [1, 2], ('a', 2): [3, 4]})

This creates a MultiIndex dataframe:

   a   
   1  2
0  1  3
1  2  4

I want to compute column-wise mean like:

df.mean()

This should produce (as in pandas):

a  1    1.5
    2    3.5
dtype: float64

However, right now it shows an error,

ValueError: Data must be 1-dimensional

Right now, I can make it work by doing the computation in cupy and explicitly creating a Series object:

cudf.Series(df.to_cupy().mean(axis=0), index=df.columns)

but I wish it was native in cudf.

@amanlai amanlai added the feature request New feature or request label Feb 19, 2024
@shwina shwina added bug Something isn't working Python Affects Python cuDF API. and removed feature request New feature or request labels Feb 20, 2024
@mroeschke mroeschke self-assigned this Feb 20, 2024
rapids-bot bot pushed a commit that referenced this issue Feb 21, 2024
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
None yet
Development

Successfully merging a pull request may close this issue.

3 participants