-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
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
Conversation
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. |
in place are disable as Index are disabled anyhow |
def test_promote_type_inplace(self): | ||
# Related to GH-9966 | ||
index = Int64Index(np.arange(5)) | ||
index += np.pi |
There was a problem hiding this comment.
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 ).
There was a problem hiding this comment.
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.
want to update for 0.17.0? |
can you update? |
Sorry I haven't gotten back to you before. I'm afraid I'll be to busy to be 2015-06-27 1:34 GMT+02:00 jreback [email protected]:
|
closing in favor of #10638 |
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.