pandas icon indicating copy to clipboard operation
pandas copied to clipboard

BUG: binary operations don't propogate attrs depending on order with Series and/or DataFrame/Series

Open mroeschke opened this issue 2 years ago • 2 comments
trafficstars

Pandas version checks

  • [X] I have checked that this issue has not already been reported.

  • [X] I have confirmed this bug exists on the latest version of pandas.

  • [X] I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

In [1]: ser1 = pd.Series(range(1))

In [2]: ser2 = pd.Series(range(1))

In [3]: ser1.attrs = {1:2}

In [4]: val = ser2 + ser1

In [5]: val.attrs
Out[5]: {}

Issue Description

val.attrs should be {1:2}

The relevant tests are xfailed in test_finalize.py::test_binary

Expected Behavior

val.attrs should be {1:2}

Installed Versions

Replace this line with the output of pd.show_versions()

mroeschke avatar Feb 24 '23 00:02 mroeschke

take

fridaagronberg avatar Feb 24 '23 10:02 fridaagronberg

In situations like this, if both series had the same attrs, but different values how would we decide whose attr to take? Is it almost left most for binary ops?

Delengowski avatar Feb 17 '24 15:02 Delengowski