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 first and last modify datatype #2763

Closed
courosh opened this issue Jan 28, 2013 · 1 comment · Fixed by #3152
Closed

groupby first and last modify datatype #2763

courosh opened this issue Jan 28, 2013 · 1 comment · Fixed by #3152
Milestone

Comments

@courosh
Copy link

courosh commented Jan 28, 2013

Using groupby(level=0).first() or groupby(level=0).last() to eliminate duplicate index entries modifies integer data types to float.

import pandas as pd
idx = range(10)
idx.append(9)
df = pd.Series(data=range(11), index=idx, name='IntCol')
print df
print df.dtype

0     0
1     1
2     2
3     3
4     4
5     5
6     6
7     7
8     8
9     9
9    10
Name: IntCol
int64

df2 = df.groupby(level=0).first()
print df2
print df2.dtype

0    0
1    1
2    2
3    3
4    4
5    5
6    6
7    7
8    8
9    9
float64
@jreback
Copy link
Contributor

jreback commented Mar 24, 2013

fixed in #3152
@courosh thanks for the report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants