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] Default type of empty list for Index should be object dtype #14091

Closed
galipremsagar opened this issue Sep 12, 2023 · 1 comment · Fixed by #14116
Closed

[BUG] Default type of empty list for Index should be object dtype #14091

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

Comments

@galipremsagar
Copy link
Contributor

galipremsagar commented Sep 12, 2023

Describe the bug
When an empty list is passed to Index constructor cudf defaults to float64, whereas pandas defaults to object. We should match the same.

Steps/Code to reproduce bug

In [1]: import cudf

In [2]: cudf.Index([])
Out[2]: Float64Index([], dtype='float64')

In [3]: import pandas as pd

In [4]: pd.Index([])
Out[4]: Index([], dtype='object')

Expected behavior

In [4]: cudf.Index([])
Out[4]: StringIndex([], dtype='object')

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
@mroeschke
Copy link
Contributor

Note that in 2.0, an empty pandas.Series also defaulted to object

rapids-bot bot pushed a commit that referenced this issue Sep 20, 2023
…14116)

Fixes: #14091 
This PR fixes empty inputs dtype in `Index` to default to `str` instead of `float64`. Another change is there is a deprecation warning for `Series` constructor to match pandas.

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

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

URL: #14116
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.

2 participants