Skip to content

DOC: Add note to docstring DataFrame.compare about identical labels #35492

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

Merged
merged 12 commits into from
Sep 24, 2020
9 changes: 9 additions & 0 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -5891,14 +5891,23 @@ def _construct_result(self, result) -> "DataFrame":
The resulting index will be a MultiIndex with 'self' and 'other'
stacked alternately at the inner level.

Raises
------
ValueError
* When `errors='raise'` and both DataFrames don't have identical labels.

See Also
--------
Series.compare : Compare with another Series and show differences.
DataFrame.equals : Test whether two objects contain the same elements.

Notes
-----
Matching NaNs will not appear as a difference.

Can only compare identically-labeled DataFrame objects,
this means DataFrames with the same shape and identical row, column labels.

Examples
--------
>>> df = pd.DataFrame(
Expand Down