Skip to content

BUG: indexers coerce partial assignment of float->int #10280

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
jreback opened this issue Jun 4, 2015 · 0 comments · Fixed by #10308
Closed

BUG: indexers coerce partial assignment of float->int #10280

jreback opened this issue Jun 4, 2015 · 0 comments · Fixed by #10308
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions Indexing Related to indexing on series/frames, not to indexes themselves
Milestone

Comments

@jreback
Copy link
Contributor

jreback commented Jun 4, 2015

xref #10264

converts int -> floats for the entire block.

In [1]: x = pd.DataFrame(data=np.zeros((5,5),dtype=np.int),columns=['a','b','c','d','e'], index=['one','two','three','four','five'])

In [3]: x.loc['three','e'] = 3.1

In [4]: x
Out[4]: 
       a  b  c  d    e
one    0  0  0  0  0.0
two    0  0  0  0  0.0
three  0  0  0  0  3.1
four   0  0  0  0  0.0
five   0  0  0  0  0.0

In [5]: x.dtypes
Out[5]: 
a    float64
b    float64
c    float64
d    float64
e    float64
dtype: object

ok for other kinds of assignments

In [6]: x = pd.DataFrame(data=np.zeros((5,5),dtype=np.int),columns=['a','b','c','d','e'], index=['one','two','three','four','five'])

 [8]: x.loc['three','e'] = 'foo'

In [9]: x
Out[9]: 
       a  b  c  d    e
one    0  0  0  0    0
two    0  0  0  0    0
three  0  0  0  0  foo
four   0  0  0  0    0
five   0  0  0  0    0

In [10]: x.dtypes
Out[10]: 
a     int64
b     int64
c     int64
d     int64
e    object
dtype: object

@jreback jreback added Bug Indexing Related to indexing on series/frames, not to indexes themselves Dtype Conversions Unexpected or buggy dtype conversions labels Jun 4, 2015
@jreback jreback added this to the Next Major Release milestone Jun 4, 2015
@jreback jreback modified the milestones: 0.16.2, Next Major Release Jun 8, 2015
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 Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant