Skip to content

BUG: dtypes on empty frame are incorrect #4272

Closed
@jreback

Description

@jreback
In [1]: df = DataFrame(columns=list('xyz'))

In [2]: df
Out[2]: 
Empty DataFrame
Columns: [x, y, z]
Index: []

In [3]: df.dtypes
Out[3]: 
x   NaN
y   NaN
z   NaN
dtype: float64

In [5]: df['x'].dtype
Out[5]: dtype('O')

expected

In [11]: Series(dict([ (s,np.dtype('O')) for s in list('xyz')]))
Out[11]: 
x    object
y    object
z    object
dtype: object

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions