Skip to content
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

ENH: add suffixes argument to compare #44365

Closed
wants to merge 4 commits into from
Closed

ENH: add suffixes argument to compare #44365

wants to merge 4 commits into from

Conversation

erfannariman
Copy link
Member

suffixes = ["left", "right"]
comp = df1.compare(df2, suffixes=suffixes)

result_suffixes = comp.columns.get_level_values(1).unique()
Copy link
Contributor

Choose a reason for hiding this comment

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

can you use tm.assert_frame_equal here to assert the results

@@ -8532,7 +8533,7 @@ def compare(
else:
axis = self._get_axis_number(align_axis)

diff = concat([self, other], axis=axis, keys=keys)
diff = concat([self, other], axis=axis, keys=suffixes)
Copy link
Contributor

Choose a reason for hiding this comment

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

these must be a tuple and non-None right? can you add a check and tests the cases (e.g. this is similar to what we checkin merge for example)

@@ -7246,12 +7246,14 @@ def compare(
align_axis: Axis = 1,
keep_shape: bool = False,
keep_equal: bool = False,
suffixes: Suffixes = ("self", "other"),
Copy link
Contributor

Choose a reason for hiding this comment

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

pls update doc string & add a versionadded.

if we have this in the docs anywhere else (i don't think so but pls check), maybe needs updating

Copy link
Contributor

Choose a reason for hiding this comment

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

can you update the doc-string, needs a versionadded 1.4. tag

@jreback jreback added Enhancement Reshaping Concat, Merge/Join, Stack/Unstack, Explode labels Nov 14, 2021
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

also add a note in other enhancements section for 1.4

@@ -7246,12 +7246,14 @@ def compare(
align_axis: Axis = 1,
keep_shape: bool = False,
keep_equal: bool = False,
suffixes: Suffixes = ("self", "other"),
Copy link
Contributor

Choose a reason for hiding this comment

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

can you update the doc-string, needs a versionadded 1.4. tag

@github-actions
Copy link
Contributor

This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Dec 26, 2021
@mroeschke
Copy link
Member

Thanks for the pull request, but this pull request appears to have gone stale. If interested in continuing, please merge in main and address the comments and this PR can be reopened. Closing in the meantime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Reshaping Concat, Merge/Join, Stack/Unstack, Explode Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: add suffixes argument to DataFrame.compare
3 participants