-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Bug in iloc.setitem orienting IntegerArray into the wrong direction #41288
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
@@ -164,7 +164,7 @@ def check_setitem_lengths(indexer, value, values) -> bool: | |||
# a) not necessarily 1-D indexers, e.g. tuple | |||
# b) boolean indexers e.g. BoolArray | |||
if is_list_like(value): | |||
if len(indexer) != len(value): | |||
if len(indexer) != len(value) and values.ndim == 1: |
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.
would the ndim check here be necessary if EAs all supported 2D?
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.
Yes, we are passing here through with something like
df = pd.DataFrame(data={
'col1': [1, 2, 3, 4],
'col2': [3, 4, 5, 6],
'col3': [6, 7, 8, 9],
})
rhs = np.array([1, 2, 3])
df.iloc[[1]] = rhs
too. This should set row-wise, but the check assumes it sets column-wise
@@ -31,6 +31,7 @@ | |||
PeriodIndex, | |||
Series, | |||
Timestamp, | |||
array, |
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 thought we are using pd.array rather than bare array (i could be out of date here)
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.
Did not know that. Changed it
thanks @phofl very nice as always |
Thanks @jreback |
…ection (pandas-dev#41288)" This reverts commit c89b19f.
This is more or less a follow up of #39040, so don't think we need a whatsnew?