Skip to content

Conversation

jbrockmendel
Copy link
Member

@mroeschke mroeschke added the Error Reporting Incorrect or improved errors from pandas label Oct 16, 2025
@mroeschke mroeschke added this to the 3.0 milestone Oct 16, 2025
@mroeschke mroeschke merged commit 531c0e3 into pandas-dev:main Oct 16, 2025
45 checks passed
@mroeschke
Copy link
Member

Thanks @jbrockmendel

result = self._binop(other, op, level=level, fill_value=fill_value)
result._name = res_name
return result
elif isinstance(other, ABCDataFrame):
Copy link
Member

Choose a reason for hiding this comment

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

Actually last minute thought, would be worth still allowing this if the axis are already aligned?

Copy link
Member Author

Choose a reason for hiding this comment

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

so just revert and let non-aligned cases raises like before? maybe try to give a better message?

Copy link
Member

Choose a reason for hiding this comment

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

Or if ser.flex_op(df, axis=0) gives a sensible result when ser.index.equals(df.index), just have a follow up PR to amend and not ser.index.equals(df.index) to this elif. I suppose it would be good to also have a test case for ser.flex_op(df, axis=0) when the indexes are aligned

Copy link
Member Author

Choose a reason for hiding this comment

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

i think "DataFrame is not allowed" is significantly simpler to communicate than "DataFrame is not allowed except when aligned"

Copy link
Member

Choose a reason for hiding this comment

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

Yeah definitely. We can keep this as is and reconsider if anyone seriously complains

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Error Reporting Incorrect or improved errors from pandas

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Series.add(DataFrame) fails to align

2 participants