Skip to content

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

Closed

Description

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]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

PythonAffects Python cuDF API.bugSomething isn't working

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions