Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -6032,7 +6032,8 @@ def __rdivmod__(self, other) -> Tuple[DataFrame, DataFrame]:
# ----------------------------------------------------------------------
# Combination-Related

@Appender(
@doc(
_shared_docs["compare"],
"""
Returns
-------
Expand Down Expand Up @@ -6062,11 +6063,11 @@ def __rdivmod__(self, other) -> Tuple[DataFrame, DataFrame]:
Examples
--------
>>> df = pd.DataFrame(
... {
... {{
... "col1": ["a", "a", "b", "b", "a"],
... "col2": [1.0, 2.0, 3.0, np.nan, 5.0],
... "col3": [1.0, 2.0, 3.0, 4.0, 5.0]
... },
... }},
... columns=["col1", "col2", "col3"],
... )
>>> df
Expand Down Expand Up @@ -6134,9 +6135,9 @@ def __rdivmod__(self, other) -> Tuple[DataFrame, DataFrame]:
2 b b 3.0 3.0 3.0 4.0
3 b b NaN NaN 4.0 4.0
4 a a 5.0 5.0 5.0 5.0
"""
""",
klass=_shared_doc_kwargs["klass"],
)
@Appender(_shared_docs["compare"] % _shared_doc_kwargs)
def compare(
self,
other: DataFrame,
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -8516,7 +8516,7 @@ def ranker(data):

return ranker(data)

@Appender(_shared_docs["compare"] % _shared_doc_kwargs)
@doc(_shared_docs["compare"], klass=_shared_doc_kwargs["klass"])
def compare(
self,
other,
Expand Down
7 changes: 4 additions & 3 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -2813,7 +2813,8 @@ def _construct_result(
out.name = name
return out

@Appender(
@doc(
generic._shared_docs["compare"],
"""
Returns
-------
Expand Down Expand Up @@ -2873,9 +2874,9 @@ def _construct_result(
2 c c
3 d b
4 e e
"""
""",
klass=_shared_doc_kwargs["klass"],
)
@Appender(generic._shared_docs["compare"] % _shared_doc_kwargs)
def compare(
self,
other: "Series",
Expand Down
6 changes: 3 additions & 3 deletions pandas/core/shared_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@
_shared_docs[
"compare"
] = """
Compare to another %(klass)s and show the differences.
Compare to another {klass} and show the differences.
.. versionadded:: 1.1.0
Parameters
----------
other : %(klass)s
other : {klass}
Object to compare with.
align_axis : {0 or 'index', 1 or 'columns'}, default 1
align_axis : {{0 or 'index', 1 or 'columns'}}, default 1
Determine which axis to align the comparison on.
* 0, or 'index' : Resulting differences are stacked vertically
Expand Down