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] Unable to set the names attribute of DataFrame.columns #17482

Closed
Matt711 opened this issue Dec 2, 2024 · 2 comments · Fixed by #17597
Closed

[BUG] Unable to set the names attribute of DataFrame.columns #17482

Matt711 opened this issue Dec 2, 2024 · 2 comments · Fixed by #17597
Assignees
Labels
bug Something isn't working Python Affects Python cuDF API.

Comments

@Matt711
Copy link
Contributor

Matt711 commented Dec 2, 2024

Describe the bug
See the reproducer

Steps/Code to reproduce bug
cudf:

import cudf

df = cudf.DataFrame({"a":[1,2]})
print(df.columns.names)

df.columns.names = ["foo"]

print(df.columns.names)
[None]
[None]

pandas:

import pandas as pd

df = pd.DataFrame({"a":[1,2]})
print(df.columns.names)

df.columns.names = ["foo"]

print(df.columns.names)
[None]
['foo']

Expected behavior
Match pandas

@Matt711 Matt711 added the bug Something isn't working label Dec 2, 2024
@Matt711
Copy link
Contributor Author

Matt711 commented Dec 2, 2024

xref #17481

@mroeschke
Copy link
Contributor

xref #14012 too

@galipremsagar galipremsagar self-assigned this Dec 14, 2024
@galipremsagar galipremsagar added the Python Affects Python cuDF API. label Dec 14, 2024
@GPUtester GPUtester moved this from Todo to In Progress in cuDF Python Dec 14, 2024
rapids-bot bot pushed a commit that referenced this issue Dec 19, 2024
Fixes: #17482, #14012

This PR fixes a long-standing issue where modifying `columns` `name` never propagates to the parent object. This PR fixes this issue by making `to_pandas_index` a cached-property and accessing it's names if this property was ever invoked in `level_names` property.

Authors:
  - GALI PREM SAGAR (https://github.com/galipremsagar)

Approvers:
  - Matthew Roeschke (https://github.com/mroeschke)

URL: #17597
@github-project-automation github-project-automation bot moved this from In Progress to Done in cuDF Python Dec 19, 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
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants