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

groupby looses dtype on empty columns #6733

Closed
paolini opened this issue Mar 29, 2014 · 1 comment · Fixed by #6737
Closed

groupby looses dtype on empty columns #6733

paolini opened this issue Mar 29, 2014 · 1 comment · Fixed by #6737
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions Groupby
Milestone

Comments

@paolini
Copy link

paolini commented Mar 29, 2014

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
@jreback
Copy link
Contributor

jreback commented Mar 29, 2014

this actually is very subtle....thanks for the report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions Groupby
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants