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] Empty DataFrame object columns property doesn't match pandas for data=None or data={}. #15372

Open
wence- opened this issue Mar 22, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@wence-
Copy link
Contributor

wence- commented Mar 22, 2024

Describe the bug

When constructing an empty dataframe where one does not explicitly specify the column names, pandas produces a RangeIndex for the .columns property.

In contrast, cudf produces an Index(dtype=object) if data={} or data=None.

Steps/Code to reproduce bug

import cudf
import pandas as pd

for data in [{}, None]:
    columns = cudf.DataFrame(data=data).columns
    expect = pd.DataFrame(data=data).columns

    assert type(columns) == type(expect)

Expected behavior

Matching pandas. This works if data is an empty list-like object (e.g. data=[]) so it's probably just another condition to handle.

@wence- wence- added the bug Something isn't working label Mar 22, 2024
@wence- wence- self-assigned this Mar 22, 2024
@wence- wence- added the pandas label Mar 22, 2024
wence- added a commit to wence-/cudf that referenced this issue Mar 22, 2024
wence- added a commit to wence-/cudf that referenced this issue Mar 22, 2024
@vyasr vyasr removed the pandas label May 16, 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
Projects
Status: No status
Development

No branches or pull requests

2 participants