-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
BUG: Copy attrs on pd.merge() #60357
base: main
Are you sure you want to change the base?
Conversation
a9725ef
to
1d4c974
Compare
1d4c974
to
8bd828c
Compare
1e8c04b
to
6697172
Compare
This uses the same logic as `pd.concat()`: Copy `attrs` only if all input `attrs` are identical. I've refactored the handling in __finalize__ from special-casing based on th the method name (previously only "concat") to handling "other" parameters that have an `input_objs` attribute. This is a more scalable architecture compared to hard-coding method names in __finalize__. Tests added for `concat()` and `merge()`. Closes pandas-dev#60351.
6697172
to
7815e73
Compare
result = result.__finalize__( | ||
types.SimpleNamespace(input_objs=[self.left, self.right]), | ||
method=self._merge_type, | ||
) |
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.
Note: I don't really understand why __finalize__
is called twice on the result, once here with method=self._merge_type
and once below with method="merge"
. That looks dubious. If the duplication is needed, we should add a comment.
This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this. |
I'm still interested in this, and IMHO it's ready for review. |
This uses the same logic as
pd.concat()
: Copyattrs
only if all inputattrs
are identical.I've refactored the handling in finalize from special-casing based on th the method name (previously only "concat") to handling "other" parameters that have an
input_objs
attribute. This is a more scalable architecture compared to hard-coding method names in finalize.Tests added for
concat()
andmerge()
.Closes #60351.