Closed
Description
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.