From 8e437bb1af627e9f0c63134cfae864902e22ebf5 Mon Sep 17 00:00:00 2001 From: lordgrenville <16547083+lordgrenville@users.noreply.github.com> Date: Mon, 4 Feb 2019 12:40:44 +0200 Subject: [PATCH 1/2] expands docs for series arithmetic operations --- pandas/core/ops.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/pandas/core/ops.py b/pandas/core/ops.py index 10cebc6f94b92..92808c2bce87b 100644 --- a/pandas/core/ops.py +++ b/pandas/core/ops.py @@ -495,6 +495,28 @@ def _get_op_name(op, special): d 1.0 e NaN dtype: float64 +>>> a.subtract(b, fill_value=0) +a 0.0 +b 1.0 +c 1.0 +d -1.0 +e NaN +dtype: float64 +>>> a.multiply(b) +dtype: float64 +a 1.0 +b NaN +c NaN +d NaN +e NaN +dtype: float64 +>>> a.divide(b, fill_value=0) +a 1.0 +b inf +c inf +d 0.0 +e NaN +dtype: float64 """ _arith_doc_FRAME = """ From 230128166ce5a67ee953bceb6af8110a321d9f76 Mon Sep 17 00:00:00 2001 From: lordgrenville <16547083+lordgrenville@users.noreply.github.com> Date: Mon, 4 Feb 2019 12:40:44 +0200 Subject: [PATCH 2/2] DOC Adds examples to Series arithmetic operations GH23069 Validation ouput: 3 Errors found: Parameters {axis} not documented Parameter "other" has no description Missing description for See Also "Series.rmul" reference --- pandas/core/ops.py | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/pandas/core/ops.py b/pandas/core/ops.py index 10cebc6f94b92..b3b3b9dd2c20b 100644 --- a/pandas/core/ops.py +++ b/pandas/core/ops.py @@ -459,14 +459,15 @@ def _get_op_name(op, special): Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing - the result will be missing + the result will be missing. level : int or name Broadcast across a level, matching Index values on the - passed MultiIndex level + passed MultiIndex level. Returns ------- -result : Series +Series + The result of the operation. See Also -------- @@ -495,6 +496,27 @@ def _get_op_name(op, special): d 1.0 e NaN dtype: float64 +>>> a.subtract(b, fill_value=0) +a 0.0 +b 1.0 +c 1.0 +d -1.0 +e NaN +dtype: float64 +>>> a.multiply(b) +a 1.0 +b NaN +c NaN +d NaN +e NaN +dtype: float64 +>>> a.divide(b, fill_value=0) +a 1.0 +b inf +c inf +d 0.0 +e NaN +dtype: float64 """ _arith_doc_FRAME = """