Skip to content

DOC: Add example to Series.divmod #37185

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 1 commit into from
Oct 17, 2020
Merged
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
23 changes: 22 additions & 1 deletion pandas/core/ops/docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def make_flex_doc(op_name: str, typ: str) -> str:
assert op_desc_op is not None # for mypy
if op_name.startswith("r"):
equiv = "other " + op_desc_op + " " + typ
elif op_name == "divmod":
equiv = f"{op_name}({typ}, other)"
else:
equiv = typ + " " + op_desc_op + " other"

Expand Down Expand Up @@ -162,6 +164,25 @@ def make_flex_doc(op_name: str, typ: str) -> str:
"""
)

_divmod_example_SERIES = (
_common_examples_algebra_SERIES
+ """
>>> a.divmod(b, fill_value=0)
(a 1.0
b NaN
c NaN
d 0.0
e NaN
dtype: float64,
a 0.0
b NaN
c NaN
d 0.0
e NaN
dtype: float64)
"""
)

_mod_example_SERIES = (
_common_examples_algebra_SERIES
+ """
Expand Down Expand Up @@ -332,7 +353,7 @@ def make_flex_doc(op_name: str, typ: str) -> str:
"op": "divmod",
"desc": "Integer division and modulo",
"reverse": "rdivmod",
"series_examples": None,
"series_examples": _divmod_example_SERIES,
"series_returns": _returns_tuple,
"df_examples": None,
},
Expand Down