From bbfb1274c6dc274e6ac02ea8c30081576034bca4 Mon Sep 17 00:00:00 2001 From: Tuhin Sharma Date: Sun, 22 Sep 2024 10:19:59 +0530 Subject: [PATCH 1/2] DOC: fix SA01, ES01 for pandas.RangeIndex.step --- ci/code_checks.sh | 1 - pandas/core/indexes/range.py | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index f2d9f582d8932..c8e0e4aaafc02 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -73,7 +73,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.Period.freq GL08" \ -i "pandas.Period.ordinal GL08" \ -i "pandas.RangeIndex.from_range PR01,SA01" \ - -i "pandas.RangeIndex.step SA01" \ -i "pandas.Series.cat.add_categories PR01,PR02" \ -i "pandas.Series.cat.as_ordered PR01" \ -i "pandas.Series.cat.as_unordered PR01" \ diff --git a/pandas/core/indexes/range.py b/pandas/core/indexes/range.py index 75d0dfbeb6f01..84b5af28a7332 100644 --- a/pandas/core/indexes/range.py +++ b/pandas/core/indexes/range.py @@ -351,6 +351,15 @@ def step(self) -> int: """ The value of the `step` parameter (``1`` if this was not supplied). + The `step` parameter determines the increment (or decrement in the case + of negative values) between consecutive elements in the `RangeIndex`. + + See Also + -------- + RangeIndex : Immutable index implementing a range-based index. + RangeIndex.stop : Returns the stop value of the `RangeIndex`. + RangeIndex.start : Returns the start value of the `RangeIndex`. + Examples -------- >>> idx = pd.RangeIndex(5) From 97a776ac9523349731fae95ef1b86ddb1f3844ac Mon Sep 17 00:00:00 2001 From: Tuhin Sharma Date: Wed, 25 Sep 2024 23:34:49 +0530 Subject: [PATCH 2/2] DOC: add double backticks for sphinx compatibility Co-authored-by: mroeschke --- pandas/core/indexes/range.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandas/core/indexes/range.py b/pandas/core/indexes/range.py index 84b5af28a7332..dc96d1c11db74 100644 --- a/pandas/core/indexes/range.py +++ b/pandas/core/indexes/range.py @@ -351,14 +351,14 @@ def step(self) -> int: """ The value of the `step` parameter (``1`` if this was not supplied). - The `step` parameter determines the increment (or decrement in the case - of negative values) between consecutive elements in the `RangeIndex`. + The ``step`` parameter determines the increment (or decrement in the case + of negative values) between consecutive elements in the ``RangeIndex``. See Also -------- RangeIndex : Immutable index implementing a range-based index. - RangeIndex.stop : Returns the stop value of the `RangeIndex`. - RangeIndex.start : Returns the start value of the `RangeIndex`. + RangeIndex.stop : Returns the stop value of the RangeIndex. + RangeIndex.start : Returns the start value of the RangeIndex. Examples --------