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

BUG: astype assignment with loc not working #5702

Closed
TomAugspurger opened this issue Dec 15, 2013 · 1 comment · Fixed by #5704
Closed

BUG: astype assignment with loc not working #5702

TomAugspurger opened this issue Dec 15, 2013 · 1 comment · Fixed by #5704
Labels
Dtype Conversions Unexpected or buggy dtype conversions Indexing Related to indexing on series/frames, not to indexes themselves
Milestone

Comments

@TomAugspurger
Copy link
Contributor

In [10]: df = pd.DataFrame({'A': [1., 2., 3., 4.]})

In [11]: df.dtypes
Out[11]: 
A    float64
dtype: object

In [12]: df.loc[:, 'A'] = df['A'].astype(np.int64)

In [13]: df.dtypes
Out[13]: 
A    float64
dtype: object

#4624 (which closed #4312) fixed it for .iloc

@jreback
Copy link
Contributor

jreback commented Dec 15, 2013

@TomAugspurger thanks for the report...was a tad tricky, because normally I don't coerce a float block at all (it can get expensive if you have to nan check it), but only needs coercing if you are exactly replaceing the values (all of them)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants