Skip to content

Bug: dtype lost in Series.to_frame for empty series with integer name in 0.20.0rc1 #16114

Closed
@jcrist

Description

@jcrist

When doing to_frame on an empty series with an integer name, the dtype is lost in pandas 0.20.0rc1:

Pandas 0.20.0rc1

In [1]: import pandas as pd

In [2]: s = pd.Series([], name='a', dtype='f8')

In [3]: s.to_frame().dtypes # Not lost with string name
Out[3]:
a    float64
dtype: object

In [4]: s.rename(0).to_frame().dtypes # Lost with integer name
Out[4]:
0    object
dtype: object

In pandas 0.19.2 both of these keep the float64 dtype.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDtype ConversionsUnexpected or buggy dtype conversionsRegressionFunctionality that used to work in a prior pandas version

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions