Skip to content

groupby looses dtype on empty columns #6733

@paolini

Description

@paolini

In this snippet:

import pandas as pd import numpy as np print 'numpy', np.__version__ print 'pandas', pd.__version__ df = pd.DataFrame({'x': [],'range': np.arange(0)}) t = df.sort('x').groupby('x').first() print 'types', df['range'].dtype, t['range'].dtype 

it is shown that after the groupby, an empty "int" column becomes an empty "float". This is the output on my machine:

numpy 1.6.2 pandas 0.13.1 types int32 float64 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions