Skip to content

BUG: bug in setitem where type promotion is applied to entire block #10308

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

Merged
merged 1 commit into from
Jun 9, 2015

Conversation

behzadnouri
Copy link
Contributor

closes #10280

on master:

>>> df
   foo  bar  baz
a    0    1    2
b    3    4    5
>>> df.dtypes
foo    int64
bar    int64
baz    int64
dtype: object
>>> df.loc['a', 'bar'] = 3.14
>>> df.dtypes
foo    float64
bar    float64
baz    float64
dtype: object

on branch:

>>> df.dtypes
foo    int64
bar    int64
baz    int64
dtype: object
>>> df.loc['a', 'bar'] = 3.14
>>> df.dtypes
foo      int64
bar    float64
baz      int64
dtype: object
>>> df
   foo   bar  baz
a    0  3.14    2
b    3  4.00    5

@jreback jreback changed the title BUG: bug in setitem where type pormotion is applied to entire block BUG: bug in setitem where type promotion is applied to entire block Jun 8, 2015
@@ -2330,6 +2330,18 @@ def test_setitem_dtype_upcast(self):
expected = DataFrame([{"a": 1, "c" : 'foo'}, {"a": 3, "b": 2, "c" : np.nan}])
assert_frame_equal(df,expected)

# GH10280
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add some additonal tests (these should already work), for separation of other blocks types, e.g. object->float, float->object).

@jreback jreback added this to the 0.16.2 milestone Jun 8, 2015
@jreback jreback added Bug Indexing Related to indexing on series/frames, not to indexes themselves Dtype Conversions Unexpected or buggy dtype conversions labels Jun 8, 2015
@jreback
Copy link
Contributor

jreback commented Jun 9, 2015

can you update

@behzadnouri
Copy link
Contributor Author

i added more tests

@jreback
Copy link
Contributor

jreback commented Jun 9, 2015

ok thanks. ping when green

@behzadnouri
Copy link
Contributor Author

a HTTPError: HTTP Error 404: Not Found error; otherwise all green

jreback added a commit that referenced this pull request Jun 9, 2015
BUG: bug in setitem where type promotion is applied to entire block
@jreback jreback merged commit 90e067b into pandas-dev:master Jun 9, 2015
@jreback
Copy link
Contributor

jreback commented Jun 9, 2015

thanks!

@behzadnouri behzadnouri deleted the block-type-loss branch June 9, 2015 23:30
jreback added a commit that referenced this pull request Jun 10, 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 this pull request may close these issues.

BUG: indexers coerce partial assignment of float->int
2 participants