From 9057afb0a9a076744a585335ee5cc8301aec43ec Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 2 Feb 2025 15:00:55 -0500 Subject: [PATCH 1/6] change docs --- pandas/core/groupby/groupby.py | 11 +++++++---- pandas/core/window/rolling.py | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py index f9059e6e8896f..afd15208d51e4 100644 --- a/pandas/core/groupby/groupby.py +++ b/pandas/core/groupby/groupby.py @@ -3654,15 +3654,18 @@ def rolling( an integer index is not used to calculate the rolling window. closed : str, default None - If ``'right'``, the first point in the window is excluded from calculations. + Determines the inclusivity of points in the window + If ``'right'``, (First, Last] the last point in the window is included in the calculations. - If ``'left'``, the last point in the window is excluded from calculations. + If ``'left'``, [First, Last) the first point in the window is included in the calculations. - If ``'both'``, no points in the window are excluded from calculations. + If ``'both'``, [First, Last] all points in the window are included in the calculations. - If ``'neither'``, the first and last points in the window are excluded + If ``'neither'``, (First, Last) the first and last points in the window are excluded from calculations. + () and [] are referencing open and closed set notation respetively. + Default ``None`` (``'right'``). method : str {'single', 'table'}, default 'single' diff --git a/pandas/core/window/rolling.py b/pandas/core/window/rolling.py index 631ab15464942..9cf2d42ac37a8 100644 --- a/pandas/core/window/rolling.py +++ b/pandas/core/window/rolling.py @@ -929,15 +929,18 @@ class Window(BaseWindow): an integer index is not used to calculate the rolling window. closed : str, default None - If ``'right'``, the first point in the window is excluded from calculations. + Determines the inclusivity of points in the window + If ``'right'``, (First, Last] the last point in the window is included in the calculations. - If ``'left'``, the last point in the window is excluded from calculations. + If ``'left'``, [First, Last) the first point in the window is included in the calculations. - If ``'both'``, no point in the window is excluded from calculations. + If ``'both'``, [First, Last] all points in the window are included in the calculations. - If ``'neither'``, the first and last points in the window are excluded + If ``'neither'``, (First, Last) the first and last points in the window are excluded from calculations. + () and [] are referencing open and closed set notation respetively. + Default ``None`` (``'right'``). step : int, default None From c3d9cc080ff0564e90aacb6007e40d2631f19b11 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 2 Feb 2025 15:06:21 -0500 Subject: [PATCH 2/6] format --- pandas/core/groupby/groupby.py | 20 ++++++++++++-------- pandas/core/window/rolling.py | 20 ++++++++++++-------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py index afd15208d51e4..e1446d7edc4da 100644 --- a/pandas/core/groupby/groupby.py +++ b/pandas/core/groupby/groupby.py @@ -3654,18 +3654,22 @@ def rolling( an integer index is not used to calculate the rolling window. closed : str, default None - Determines the inclusivity of points in the window - If ``'right'``, (First, Last] the last point in the window is included in the calculations. + Determines the inclusivity of points in the window + If ``'right'``, (First, Last] the last point in the window + is included in the calculations. - If ``'left'``, [First, Last) the first point in the window is included in the calculations. + If ``'left'``, [First, Last) the first point in the window + is included in the calculations. - If ``'both'``, [First, Last] all points in the window are included in the calculations. + If ``'both'``, [First, Last] all points in the window + are included in the calculations. - If ``'neither'``, (First, Last) the first and last points in the window are excluded - from calculations. + If ``'neither'``, (First, Last) the first and last points + in the window are excludedfrom calculations. + + () and [] are referencing open and closed set + notation respetively. - () and [] are referencing open and closed set notation respetively. - Default ``None`` (``'right'``). method : str {'single', 'table'}, default 'single' diff --git a/pandas/core/window/rolling.py b/pandas/core/window/rolling.py index 9cf2d42ac37a8..9f67c2b36520c 100644 --- a/pandas/core/window/rolling.py +++ b/pandas/core/window/rolling.py @@ -929,18 +929,22 @@ class Window(BaseWindow): an integer index is not used to calculate the rolling window. closed : str, default None - Determines the inclusivity of points in the window - If ``'right'``, (First, Last] the last point in the window is included in the calculations. + Determines the inclusivity of points in the window + If ``'right'``, (First, Last] the last point in the window + is included in the calculations. - If ``'left'``, [First, Last) the first point in the window is included in the calculations. + If ``'left'``, [First, Last) the first point in the window + is included in the calculations. - If ``'both'``, [First, Last] all points in the window are included in the calculations. + If ``'both'``, [First, Last] all points in the window + are included in the calculations. - If ``'neither'``, (First, Last) the first and last points in the window are excluded - from calculations. + If ``'neither'``, (First, Last) the first and last points + in the window are excludedfrom calculations. + + () and [] are referencing open and closed set + notation respetively. - () and [] are referencing open and closed set notation respetively. - Default ``None`` (``'right'``). step : int, default None From 6684f34202d358ab5fb835da980a18fb2e2d38d1 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 2 Feb 2025 15:10:49 -0500 Subject: [PATCH 3/6] format --- pandas/core/groupby/groupby.py | 8 ++++---- pandas/core/window/rolling.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py index e1446d7edc4da..8515a8229dea9 100644 --- a/pandas/core/groupby/groupby.py +++ b/pandas/core/groupby/groupby.py @@ -3658,16 +3658,16 @@ def rolling( If ``'right'``, (First, Last] the last point in the window is included in the calculations. - If ``'left'``, [First, Last) the first point in the window + If ``'left'``, [First, Last) the first point in the window is included in the calculations. - If ``'both'``, [First, Last] all points in the window + If ``'both'``, [First, Last] all points in the window are included in the calculations. - If ``'neither'``, (First, Last) the first and last points + If ``'neither'``, (First, Last) the first and last points in the window are excludedfrom calculations. - () and [] are referencing open and closed set + () and [] are referencing open and closed set notation respetively. Default ``None`` (``'right'``). diff --git a/pandas/core/window/rolling.py b/pandas/core/window/rolling.py index 9f67c2b36520c..b954ce2584c13 100644 --- a/pandas/core/window/rolling.py +++ b/pandas/core/window/rolling.py @@ -933,16 +933,16 @@ class Window(BaseWindow): If ``'right'``, (First, Last] the last point in the window is included in the calculations. - If ``'left'``, [First, Last) the first point in the window + If ``'left'``, [First, Last) the first point in the window is included in the calculations. - If ``'both'``, [First, Last] all points in the window + If ``'both'``, [First, Last] all points in the window are included in the calculations. - If ``'neither'``, (First, Last) the first and last points + If ``'neither'``, (First, Last) the first and last points in the window are excludedfrom calculations. - () and [] are referencing open and closed set + () and [] are referencing open and closed set notation respetively. Default ``None`` (``'right'``). From 568d51867e96a614a3a247cd7f1c89a0824266df Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 3 Feb 2025 20:55:55 -0500 Subject: [PATCH 4/6] update window --- pandas/core/groupby/groupby.py | 6 +++--- pandas/core/window/rolling.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py index 8515a8229dea9..5140f3b3b2f77 100644 --- a/pandas/core/groupby/groupby.py +++ b/pandas/core/groupby/groupby.py @@ -3605,10 +3605,10 @@ def rolling( Parameters ---------- window : int, timedelta, str, offset, or BaseIndexer subclass - Size of the moving window. + Interval of the moving window. - If an integer, the fixed number of observations used for - each window. + If an integer, the delta between the start and end of each window. + Example: window = 3 interval from 1 -> 4 If a timedelta, str, or offset, the time period of each window. Each window will be a variable sized based on the observations included in diff --git a/pandas/core/window/rolling.py b/pandas/core/window/rolling.py index b954ce2584c13..862e5e04b746c 100644 --- a/pandas/core/window/rolling.py +++ b/pandas/core/window/rolling.py @@ -881,10 +881,10 @@ class Window(BaseWindow): Parameters ---------- window : int, timedelta, str, offset, or BaseIndexer subclass - Size of the moving window. + Interval of the moving window. - If an integer, the fixed number of observations used for - each window. + If an integer, the delta between the start and end of each window. + Example: window = 3 interval from 1 -> 4 If a timedelta, str, or offset, the time period of each window. Each window will be a variable sized based on the observations included in From a89e7458cdf83068c9f9941bbf42e83f3063e22f Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 3 Feb 2025 21:28:17 -0500 Subject: [PATCH 5/6] address comments --- pandas/core/groupby/groupby.py | 15 ++++++++------- pandas/core/window/rolling.py | 15 ++++++++------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py index 9f8ecd6a0d565..92b93aa280f6a 100644 --- a/pandas/core/groupby/groupby.py +++ b/pandas/core/groupby/groupby.py @@ -3664,7 +3664,7 @@ def rolling( Interval of the moving window. If an integer, the delta between the start and end of each window. - Example: window = 3 interval from 1 -> 4 + The number of points in the window depends on the ``closed`` argument. If a timedelta, str, or offset, the time period of each window. Each window will be a variable sized based on the observations included in @@ -3711,17 +3711,18 @@ def rolling( closed : str, default None Determines the inclusivity of points in the window - If ``'right'``, (First, Last] the last point in the window + + If ``'right'``, uses the window (first, last] meaning the last point is included in the calculations. - If ``'left'``, [First, Last) the first point in the window + If ``'left'``, uses the window [first, last) meaning the first point is included in the calculations. - If ``'both'``, [First, Last] all points in the window - are included in the calculations. + If ``'both'``, uses the window [first, last] meaning all points in + the window are included in the calculations. - If ``'neither'``, (First, Last) the first and last points - in the window are excludedfrom calculations. + If ``'neither'``, uses the window (first, last) meaning the first + and last points in the window are excluded from calculations. () and [] are referencing open and closed set notation respetively. diff --git a/pandas/core/window/rolling.py b/pandas/core/window/rolling.py index 862e5e04b746c..c9bd26ab0ce76 100644 --- a/pandas/core/window/rolling.py +++ b/pandas/core/window/rolling.py @@ -884,7 +884,7 @@ class Window(BaseWindow): Interval of the moving window. If an integer, the delta between the start and end of each window. - Example: window = 3 interval from 1 -> 4 + The number of points in the window depends on the ``closed`` argument. If a timedelta, str, or offset, the time period of each window. Each window will be a variable sized based on the observations included in @@ -930,17 +930,18 @@ class Window(BaseWindow): closed : str, default None Determines the inclusivity of points in the window - If ``'right'``, (First, Last] the last point in the window + + If ``'right'``, uses the window (first, last] meaning the last point is included in the calculations. - If ``'left'``, [First, Last) the first point in the window + If ``'left'``, uses the window [first, last) meaning the first point is included in the calculations. - If ``'both'``, [First, Last] all points in the window - are included in the calculations. + If ``'both'``, uses the window [first, last] meaning all points in + the window are included in the calculations. - If ``'neither'``, (First, Last) the first and last points - in the window are excludedfrom calculations. + If ``'neither'``, uses the window (first, last) meaning the first + and last points in the window are excluded from calculations. () and [] are referencing open and closed set notation respetively. From ff17ffcb7e67da28ba21c2931a135708a9ebc13c Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 3 Feb 2025 21:31:47 -0500 Subject: [PATCH 6/6] format --- pandas/core/groupby/groupby.py | 4 ++-- pandas/core/window/rolling.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py index c4d8306f8ac47..d0c0ed29b6d44 100644 --- a/pandas/core/groupby/groupby.py +++ b/pandas/core/groupby/groupby.py @@ -3716,10 +3716,10 @@ def rolling( If ``'left'``, uses the window [first, last) meaning the first point is included in the calculations. - If ``'both'``, uses the window [first, last] meaning all points in + If ``'both'``, uses the window [first, last] meaning all points in the window are included in the calculations. - If ``'neither'``, uses the window (first, last) meaning the first + If ``'neither'``, uses the window (first, last) meaning the first and last points in the window are excluded from calculations. () and [] are referencing open and closed set diff --git a/pandas/core/window/rolling.py b/pandas/core/window/rolling.py index c9bd26ab0ce76..69fce8cf2137e 100644 --- a/pandas/core/window/rolling.py +++ b/pandas/core/window/rolling.py @@ -937,10 +937,10 @@ class Window(BaseWindow): If ``'left'``, uses the window [first, last) meaning the first point is included in the calculations. - If ``'both'``, uses the window [first, last] meaning all points in + If ``'both'``, uses the window [first, last] meaning all points in the window are included in the calculations. - If ``'neither'``, uses the window (first, last) meaning the first + If ``'neither'``, uses the window (first, last) meaning the first and last points in the window are excluded from calculations. () and [] are referencing open and closed set