Skip to content

itertuples converts int to float for all numeric rows. #1505

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

Closed
gerigk opened this issue Jun 21, 2012 · 0 comments
Closed

itertuples converts int to float for all numeric rows. #1505

gerigk opened this issue Jun 21, 2012 · 0 comments
Labels
Milestone

Comments

@gerigk
Copy link

gerigk commented Jun 21, 2012

from pandas import *
x = DataFrame([(1,3,4.5,6.5), (1,3,4.5,6.5)])
print x
print x.dtypes
for row in x.itertuples():
    print row

   0  1    2    3
0  1  3  4.5  6.5
1  1  3  4.5  6.5
0      int64
1      int64
2    float64
3    float64
(0, 1.0, 3.0, 4.5, 6.5)
(1, 1.0, 3.0, 4.5, 6.5)

mixed dtype row leaves ints untouched

rom pandas import *
x = DataFrame([(1,3,4.5,6.5,'a'), (1,3,4.5,6.5, 'b')])
print x
print x.dtypes
for row in x.itertuples():
    print row

  0  1    2    3  4
0  1  3  4.5  6.5  a
1  1  3  4.5  6.5  b
0      int64
1      int64
2    float64
3    float64
4     object
(0, 1, 3, 4.5, 6.5, 'a')
(1, 1, 3, 4.5, 6.5, 'b')
@wesm wesm closed this as completed in 2c51144 Jun 21, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants