-
-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
DataFrame.loc/iloc fails to update object with new dtype #24269
Comments
Something that might be useful to note is that when indexing with a single label we get the expected output. For example:
However as you mentioned before:
So the issue might have something to do with casting and indexing the dataframe with a list of labels versus single label? |
I'm not sure if this fix is the right way to resolve the problem, but I've added another control statement so that updating dataframe values corresponding to a list of labels is handled the same way as updating dataframe values corresponding to a single label. The performance test pandas/pandas/core/indexing.py Lines 618 to 652 in 04a0eac
Changes were made based on my previous comment. When indexing via single label the code goes through lines 624-631 (see code snipped above). When indexing via a list of labels the code goes through lines 649-652. |
on master the first case fails to convert now as well.
|
Similar to #4312 and #5702, but this seems specific to object dtype -> new dytpe.
In this first case, we likely convert the whole block, even though we just wanted
A
.In this one, (maybe a different bug), we fail to convert
['a', 'b']
to float when they start out in an object block with other values.The text was updated successfully, but these errors were encountered: