-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: loc casting to object for multi block case when setting with list indexer #49161
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
pandas/core/indexing.py
Outdated
# setting with a list, re-coerces | ||
self._setitem_single_column(loc, value[:, i].tolist(), pi) | ||
value_col = value[:, i] | ||
if is_object_dtype(value_col): |
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.
nitpick value_col -> value_col.dtype
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.
Changed
@@ -1898,16 +1898,20 @@ def _setitem_with_indexer_2d_value(self, indexer, value): | |||
|
|||
ilocs = self._ensure_iterable_column_indexer(indexer[1]) | |||
|
|||
# GH#7551 Note that this coerces the dtype if we are mixed |
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.
is the GH reference here worth keeping somewhere?
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.
Don't think so, since we are avoiding this now
pandas/core/indexing.py
Outdated
self._setitem_single_column(loc, value[:, i].tolist(), pi) | ||
value_col = value[:, i] | ||
if is_object_dtype(value_col): | ||
# try coerce values as good as possible |
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.
the wording here is pretty kludgy, maybe "casting to list so that we do type inference in setitem_single_column"
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.
Changed, thx
Thanks @phofl |
…t indexer (pandas-dev#49161) * BUG: loc casting to object for multi block case when setting with list indexer * Remove xpasses * Fix windows * Adress comments * Remove condition
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.