Skip to content
9 changes: 9 additions & 0 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -5932,14 +5932,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 the two DataFrames don't have identical labels or shape.

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
(i.e. same shape, identical row and column labels) DataFrames

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