Skip to content

Change of index values dtype should be reflected in index type #9974

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
wants to merge 3 commits into from

Conversation

josteinbf
Copy link

This PR should eventually address issue #9966. I will look at testing first to make sure I have understood how pandas ought to work in these situations.

@josteinbf
Copy link
Author

Tests should fail for now.

@jreback Do you agree that the inplace multiplication in 6279449 should raise an Exception? I guess what I'm really asking is if there is a way an object can change its type in response to an inplace operation? There might be, because this works for simple ints and floats.

@jreback
Copy link
Contributor

jreback commented Apr 23, 2015

in place are disable as Index are disabled anyhow
so u can test for this but it shouldn't work (eg test that it raises)

def test_promote_type_inplace(self):
# Related to GH-9966
index = Int64Index(np.arange(5))
index += np.pi
Copy link
Contributor

Choose a reason for hiding this comment

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

these should all fail with a TypeError (IIRC). inplace ops are not allowed on an immutable type (I guess its not actually disabled though ).

Copy link
Member

Choose a reason for hiding this comment

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

I know that in some cases Python will automatically treat an in-place operation like x += y as x = x + y, e.g., if you implement __add__ but not __iadd__. This is how inplace operations work on integers, for example, which are immutable.

In any case, this should certainly fail with TypeError if index is the same object on both these lines.

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

jreback commented May 9, 2015

want to update for 0.17.0?

@jreback
Copy link
Contributor

jreback commented Jun 26, 2015

can you update?

@josteinbf
Copy link
Author

Sorry I haven't gotten back to you before. I'm afraid I'll be to busy to be
able to finish the remaining parts here.

2015-06-27 1:34 GMT+02:00 jreback [email protected]:

can you update?


Reply to this email directly or view it on GitHub
#9974 (comment).

@jreback jreback mentioned this pull request Jul 20, 2015
2 tasks
@jreback
Copy link
Contributor

jreback commented Aug 5, 2015

closing in favor of #10638

@jreback jreback closed this Aug 5, 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.

3 participants