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

Buggy creation of int DataFrame from data containing NAs #846

Closed
wesm opened this issue Mar 1, 2012 · 2 comments
Closed

Buggy creation of int DataFrame from data containing NAs #846

wesm opened this issue Mar 1, 2012 · 2 comments
Labels
Milestone

Comments

@wesm
Copy link
Member

wesm commented Mar 1, 2012

In [5]: df = DataFrame([[np.nan, 1], [1, 0]], dtype=np.int64)

In [6]: df
Out[6]: 
                     0  1
0 -9223372036854775808  1
1                    1  0
@lbeltrame
Copy link
Contributor

Changing dtype at runtime still causes the wrong cast, however:

In [7]: test = pandas.DataFrame(data={"Values":[1.0, 2.0, 3.0, np.nan]})

In [8]: test["Values"].astype("int64")
Out[8]: 
0                      1
1                      2
2                      3
3   -9223372036854775808
Name: Values

@wesm wesm reopened this Mar 29, 2012
@wesm wesm closed this as completed in 9ea685e Apr 9, 2012
@wesm
Copy link
Member Author

wesm commented Apr 9, 2012

did some more work here, casting to integer with NAs raises a ValueError now

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