Skip to content

Commit dd77904

Browse files
hongshaoyangJulianWgs
authored andcommitted
DOC: Add example to Series.divmod (pandas-dev#37185)
1 parent 01ba21a commit dd77904

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

pandas/core/ops/docstrings.py

+22-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ def make_flex_doc(op_name: str, typ: str) -> str:
2626
assert op_desc_op is not None # for mypy
2727
if op_name.startswith("r"):
2828
equiv = "other " + op_desc_op + " " + typ
29+
elif op_name == "divmod":
30+
equiv = f"{op_name}({typ}, other)"
2931
else:
3032
equiv = typ + " " + op_desc_op + " other"
3133

@@ -162,6 +164,25 @@ def make_flex_doc(op_name: str, typ: str) -> str:
162164
"""
163165
)
164166

167+
_divmod_example_SERIES = (
168+
_common_examples_algebra_SERIES
169+
+ """
170+
>>> a.divmod(b, fill_value=0)
171+
(a 1.0
172+
b NaN
173+
c NaN
174+
d 0.0
175+
e NaN
176+
dtype: float64,
177+
a 0.0
178+
b NaN
179+
c NaN
180+
d 0.0
181+
e NaN
182+
dtype: float64)
183+
"""
184+
)
185+
165186
_mod_example_SERIES = (
166187
_common_examples_algebra_SERIES
167188
+ """
@@ -332,7 +353,7 @@ def make_flex_doc(op_name: str, typ: str) -> str:
332353
"op": "divmod",
333354
"desc": "Integer division and modulo",
334355
"reverse": "rdivmod",
335-
"series_examples": None,
356+
"series_examples": _divmod_example_SERIES,
336357
"series_returns": _returns_tuple,
337358
"df_examples": None,
338359
},

0 commit comments

Comments
 (0)