From 0ae746fa8dbbb8ad22a117df96ebc71dd35e1afa Mon Sep 17 00:00:00 2001 From: Shao Yang Hong Date: Sat, 17 Oct 2020 10:41:10 +0800 Subject: [PATCH] DOC: Add example to Series.divmod --- pandas/core/ops/docstrings.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/pandas/core/ops/docstrings.py b/pandas/core/ops/docstrings.py index 08b7b0e89ea5f..06ed321327e06 100644 --- a/pandas/core/ops/docstrings.py +++ b/pandas/core/ops/docstrings.py @@ -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" @@ -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 + """ @@ -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, },