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] Columns name not being preserved in DataFrame constructor #14088

Closed
galipremsagar opened this issue Sep 12, 2023 · 0 comments · Fixed by #14110
Closed

[BUG] Columns name not being preserved in DataFrame constructor #14088

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

Comments

@galipremsagar
Copy link
Contributor

Describe the bug
When an index object is passed to columns parameter in DataFrame constructor, the column name is not being preserved. I know there are some design issues are not being able to assign column name to column objects, but this is probably a bug.

Steps/Code to reproduce bug

In [1]: import cudf

In [2]: df = cudf.DataFrame(columns=cudf.Index(['a'], name='n'))
df

In [3]: df
Out[3]: 
Empty DataFrame
Columns: [a]
Index: []

In [4]: df.columns
Out[4]: Index(['a'], dtype='object')

In [5]: import pandas as pd

In [6]: pdf = pd.DataFrame(columns=pd.Index(['a'], name='n'))

In [7]: pdf.columns
Out[7]: Index(['a'], dtype='object', name='n')

In [8]: df = cudf.DataFrame(columns=pd.Index(['a'], name='n'))

In [9]: df.columns
Out[9]: Index(['a'], dtype='object')

Expected behavior

In [7]: df.columns
Out[7]: Index(['a'], dtype='object', name='n')

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
rapids-bot bot pushed a commit that referenced this issue Sep 27, 2023
Fixes: #14088 

This PR preserves `names` of `column` object while constructing a `DataFrame` through various constructor flows.

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

Approvers:
  - Bradley Dice (https://github.com/bdice)
  - Ashwin Srinath (https://github.com/shwina)

URL: #14110
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