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

API: Use object dtype for empty Series #17261

Closed
TomAugspurger opened this issue Aug 15, 2017 · 6 comments · Fixed by #29405
Closed

API: Use object dtype for empty Series #17261

TomAugspurger opened this issue Aug 15, 2017 · 6 comments · Fixed by #29405
Labels
API Design Constructors Series/DataFrame/Index/pd.array Constructors Dtype Conversions Unexpected or buggy dtype conversions
Milestone

Comments

@TomAugspurger
Copy link
Contributor

Currently an empty Series has a float dtype:

In [15]: pd.Series().dtype
Out[15]: dtype('float64')

This is consistent with NumPy, but inconsistent with the rest of pandas:

In [18]: pd.Index([]).dtype
Out[18]: dtype('O')

In [19]: pd.DataFrame(columns=['A']).dtypes
Out[19]:
A    object
dtype: object

I think it's best to just make all our containers treat empty as object dtype, unless explicitly told otherwise (excluding specialized containers like Int64Index).

@jreback
Copy link
Contributor

jreback commented Aug 15, 2017

xref #1783

@TomAugspurger
Copy link
Contributor Author

This will potentially fix #16737 as well

@jreback
Copy link
Contributor

jreback commented Aug 15, 2017

This will potentially fix #16737 as well

not at all, that is completely different, but #16961 is a PR for that would fix.

@TomAugspurger
Copy link
Contributor Author

Probably not getting to this for 0.24.

@TomAugspurger
Copy link
Contributor Author

Pushing again :/ Maybe forever at this point?

@TomAugspurger TomAugspurger modified the milestones: 0.25.0, 0.25.1 Jul 2, 2019
@jbrockmendel jbrockmendel added the Constructors Series/DataFrame/Index/pd.array Constructors label Jul 23, 2019
@TomAugspurger TomAugspurger modified the milestones: 0.25.1, 1.0 Aug 8, 2019
@SaturnFromTitan
Copy link
Contributor

I'm looking into this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Constructors Series/DataFrame/Index/pd.array Constructors Dtype Conversions Unexpected or buggy dtype conversions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants