Before

…lines 1–2035 unchanged (2035 lines)
2036 if on is None:
2037 on = "index"
2038 raise ValueError(f"{on} {msg}")
2039
2040 def aggregate(self, func=None, *args, **kwargs):
2041 """
2042 Aggregate using one or more operations over the specified axis.
2043
2044 Parameters
2045 ----------
2046 func : function, str, list or dict
2047 Function to use for aggregating the data. If a function, must either
2048 work when passed a Series/Dataframe or
…lines 2049–2117 unchanged (69 lines)
2118 return super().aggregate(func, *args, **kwargs)
2119
2120 agg = aggregate
2121
2122 def count(self, numeric_only: bool = False):
2123 """
2124 Calculate the rolling count of non NaN observations.
2125
2126 Parameters
2127 ----------
2128 numeric_only : bool, default False
2129 Include only float, int, boolean columns.
2130
…lines 2131–2170 unchanged (40 lines)
2171 engine: Literal["cython", "numba"] | None = None,
2172 engine_kwargs: dict[str, bool] | None = None,
2173 args: tuple[Any, ...] | None = None,
2174 kwargs: dict[str, Any] | None = None,
2175 ):
2176 """
2177 Calculate the rolling custom aggregation function.
2178
2179 Parameters
2180 ----------
2181 func : function
2182 Must produce a single value from an ndarray input if ``raw=True``
2183 or a single value from a Series if ``raw=False``. Can also accept a
…lines 2184–2352 unchanged (169 lines)
2353 self,
2354 numeric_only: bool = False,
2355 engine: Literal["cython", "numba"] | None = None,
2356 engine_kwargs: dict[str, bool] | None = None,
2357 ):
2358 """
2359 Calculate the rolling sum.
2360
2361 Parameters
2362 ----------
2363 numeric_only : bool, default False
2364 Include only float, int, boolean columns.
2365
…lines 2366–2451 unchanged (86 lines)
2452 *args,
2453 engine: Literal["cython", "numba"] | None = None,
2454 engine_kwargs: dict[str, bool] | None = None,
2455 **kwargs,
2456 ):
2457 """
2458 Calculate the rolling maximum.
2459
2460 Parameters
2461 ----------
2462 numeric_only : bool, default False
2463 Include only float, int, boolean columns.
2464
…lines 2465–2520 unchanged (56 lines)
2521 self,
2522 numeric_only: bool = False,
2523 engine: Literal["cython", "numba"] | None = None,
2524 engine_kwargs: dict[str, bool] | None = None,
2525 ):
2526 """
2527 Calculate the rolling minimum.
2528
2529 Parameters
2530 ----------
2531 numeric_only : bool, default False
2532 Include only float, int, boolean columns.
2533
…lines 2534–2586 unchanged (53 lines)
2587 self,
2588 numeric_only: bool = False,
2589 engine: Literal["cython", "numba"] | None = None,
2590 engine_kwargs: dict[str, bool] | None = None,
2591 ):
2592 """
2593 Calculate the rolling mean.
2594
2595 Parameters
2596 ----------
2597 numeric_only : bool, default False
2598 Include only float, int, boolean columns.
2599
…lines 2600–2659 unchanged (60 lines)
2660 self,
2661 numeric_only: bool = False,
2662 engine: Literal["cython", "numba"] | None = None,
2663 engine_kwargs: dict[str, bool] | None = None,
2664 ):
2665 """
2666 Calculate the rolling median.
2667
2668 Parameters
2669 ----------
2670 numeric_only : bool, default False
2671 Include only float, int, boolean columns.
2672
…lines 2673–2726 unchanged (54 lines)
2727 ddof: int = 1,
2728 numeric_only: bool = False,
2729 engine: Literal["cython", "numba"] | None = None,
2730 engine_kwargs: dict[str, bool] | None = None,
2731 ):
2732 """
2733 Calculate the rolling standard deviation.
2734
2735 Parameters
2736 ----------
2737 ddof : int, default 1
2738 Delta Degrees of Freedom. The divisor used in calculations
2739 is ``N - ddof``, where ``N`` represents the number of elements.
…lines 2740–2800 unchanged (61 lines)
2801 ddof: int = 1,
2802 numeric_only: bool = False,
2803 engine: Literal["cython", "numba"] | None = None,
2804 engine_kwargs: dict[str, bool] | None = None,
2805 ):
2806 """
2807 Calculate the rolling variance.
2808
2809 Parameters
2810 ----------
2811 ddof : int, default 1
2812 Delta Degrees of Freedom. The divisor used in calculations
2813 is ``N - ddof``, where ``N`` represents the number of elements.
…lines 2814–2868 unchanged (55 lines)
2869 engine=engine,
2870 engine_kwargs=engine_kwargs,
2871 )
2872
2873 def skew(self, numeric_only: bool = False):
2874 """
2875 Calculate the rolling unbiased skewness.
2876
2877 Parameters
2878 ----------
2879 numeric_only : bool, default False
2880 Include only float, int, boolean columns.
2881
…lines 2882–2909 unchanged (28 lines)
2910 dtype: float64
2911 """
2912 return super().skew(numeric_only=numeric_only)
2913
2914 def sem(self, ddof: int = 1, numeric_only: bool = False):
2915 """
2916 Calculate the rolling standard error of mean.
2917
2918 Parameters
2919 ----------
2920 ddof : int, default 1
2921 Delta Degrees of Freedom. The divisor used in calculations
2922 is ``N - ddof``, where ``N`` represents the number of elements.
…lines 2923–2954 unchanged (32 lines)
2955 return self.std(numeric_only=numeric_only, ddof=ddof) / (
2956 self.count(numeric_only)
2957 ).pow(0.5)
2958
2959 def kurt(self, numeric_only: bool = False):
2960 """
2961 Calculate the rolling Fisher's definition of kurtosis without bias.
2962
2963 Parameters
2964 ----------
2965 numeric_only : bool, default False
2966 Include only float, int, boolean columns.
2967
…lines 2968–3002 unchanged (35 lines)
3003 dtype: float64
3004 """
3005 return super().kurt(numeric_only=numeric_only)
3006
3007 def first(self, numeric_only: bool = False):
3008 """
3009 Calculate the rolling First (left-most) element of the window.
3010
3011 Parameters
3012 ----------
3013 numeric_only : bool, default False
3014 Include only float, int, boolean columns.
3015
…lines 3016–3037 unchanged (22 lines)
3038 dtype: float64
3039 """
3040 return super().first(numeric_only=numeric_only)
3041
3042 def last(self, numeric_only: bool = False):
3043 """
3044 Calculate the rolling Last (right-most) element of the window.
3045
3046 Parameters
3047 ----------
3048 numeric_only : bool, default False
3049 Include only float, int, boolean columns.
3050
…lines 3051–3077 unchanged (27 lines)
3078 self,
3079 q: float,
3080 interpolation: QuantileInterpolation = "linear",
3081 numeric_only: bool = False,
3082 ):
3083 """
3084 Calculate the rolling quantile.
3085
3086 Parameters
3087 ----------
3088 q : float
3089 Quantile to compute. 0 <= quantile <= 1.
3090
…lines 3091–3141 unchanged (51 lines)
3142 method: WindowingRankType = "average",
3143 ascending: bool = True,
3144 pct: bool = False,
3145 numeric_only: bool = False,
3146 ):
3147 """
3148 Calculate the rolling rank.
3149
3150 Parameters
3151 ----------
3152 method : {'average', 'min', 'max'}, default 'average'
3153 How to rank the group of records that have the same value (i.e. ties):
3154
…lines 3155–3263 unchanged (109 lines)
3264 other: DataFrame | Series | None = None,
3265 pairwise: bool | None = None,
3266 ddof: int = 1,
3267 numeric_only: bool = False,
3268 ):
3269 """
3270 Calculate the rolling sample covariance.
3271
3272 Parameters
3273 ----------
3274 other : Series or DataFrame, optional
3275 If not supplied then will default to self and produce pairwise
3276 output.
…lines 3277–3324 unchanged (48 lines)
3325 other: DataFrame | Series | None = None,
3326 pairwise: bool | None = None,
3327 ddof: int = 1,
3328 numeric_only: bool = False,
3329 ):
3330 """
3331 Calculate the rolling correlation.
3332
3333 Parameters
3334 ----------
3335 other : Series or DataFrame, optional
3336 If not supplied then will default to self and produce pairwise
3337 output.
…lines 3338–3517 unchanged (180 lines)

After

…lines 1–2037 unchanged (2037 lines)
2038 raise ValueError(f"{on} {msg}")
2039
2040 def aggregate(self, func=None, *args, **kwargs):
2041 """
2042 Aggregate using one or more operations over the specified axis.
2043
2044 This method allows combining multiple aggregation functions (e.g.
2045 ``'sum'``, ``'mean'``) in a single call, returning a result for each
2046 function applied to each rolling window.
2047
2048 Parameters
2049 ----------
2050 func : function, str, list or dict
2051 Function to use for aggregating the data. If a function, must either
2052 work when passed a Series/Dataframe or
2053 when passed to Series/Dataframe.apply.
2054
…lines 2055–2123 unchanged (69 lines)
2124 agg = aggregate
2125
2126 def count(self, numeric_only: bool = False):
2127 """
2128 Calculate the rolling count of non NaN observations.
2129
2130 This is useful for identifying windows with missing data, as it counts
2131 only non-NaN entries within each window.
2132
2133 Parameters
2134 ----------
2135 numeric_only : bool, default False
2136 Include only float, int, boolean columns.
2137
2138 Returns
2139 -------
…lines 2140–2179 unchanged (40 lines)
2180 args: tuple[Any, ...] | None = None,
2181 kwargs: dict[str, Any] | None = None,
2182 ):
2183 """
2184 Calculate the rolling custom aggregation function.
2185
2186 Applies an arbitrary function to each rolling window. This is useful
2187 when the built-in rolling methods do not cover the desired computation.
2188
2189 Parameters
2190 ----------
2191 func : function
2192 Must produce a single value from an ndarray input if ``raw=True``
2193 or a single value from a Series if ``raw=False``. Can also accept a
2194 Numba JIT function with ``engine='numba'`` specified.
2195
…lines 2196–2364 unchanged (169 lines)
2365 engine: Literal["cython", "numba"] | None = None,
2366 engine_kwargs: dict[str, bool] | None = None,
2367 ):
2368 """
2369 Calculate the rolling sum.
2370
2371 This is equivalent to applying ``numpy.sum`` over each rolling window.
2372 Missing values (NaN) are excluded from the calculation.
2373
2374 Parameters
2375 ----------
2376 numeric_only : bool, default False
2377 Include only float, int, boolean columns.
2378
2379 engine : str, default None
2380 * ``'cython'`` : Runs the operation through C-extensions from cython.
…lines 2381–2466 unchanged (86 lines)
2467 engine_kwargs: dict[str, bool] | None = None,
2468 **kwargs,
2469 ):
2470 """
2471 Calculate the rolling maximum.
2472
2473 This is equivalent to applying ``numpy.max`` over each rolling window.
2474
2475 Parameters
2476 ----------
2477 numeric_only : bool, default False
2478 Include only float, int, boolean columns.
2479
2480 *args : iterable, optional
2481 Positional arguments passed into ``func``.
…lines 2482–2537 unchanged (56 lines)
2538 engine: Literal["cython", "numba"] | None = None,
2539 engine_kwargs: dict[str, bool] | None = None,
2540 ):
2541 """
2542 Calculate the rolling minimum.
2543
2544 This is equivalent to applying ``numpy.min`` over each rolling window.
2545
2546 Parameters
2547 ----------
2548 numeric_only : bool, default False
2549 Include only float, int, boolean columns.
2550
2551 engine : str, default None
2552 * ``'cython'`` : Runs the operation through C-extensions from cython.
…lines 2553–2605 unchanged (53 lines)
2606 engine: Literal["cython", "numba"] | None = None,
2607 engine_kwargs: dict[str, bool] | None = None,
2608 ):
2609 """
2610 Calculate the rolling mean.
2611
2612 This is equivalent to applying ``numpy.mean`` over each rolling window.
2613
2614 Parameters
2615 ----------
2616 numeric_only : bool, default False
2617 Include only float, int, boolean columns.
2618
2619 engine : str, default None
2620 * ``'cython'`` : Runs the operation through C-extensions from cython.
…lines 2621–2680 unchanged (60 lines)
2681 engine: Literal["cython", "numba"] | None = None,
2682 engine_kwargs: dict[str, bool] | None = None,
2683 ):
2684 """
2685 Calculate the rolling median.
2686
2687 This is equivalent to applying ``numpy.median`` over each rolling
2688 window.
2689
2690 Parameters
2691 ----------
2692 numeric_only : bool, default False
2693 Include only float, int, boolean columns.
2694
2695 engine : str, default None
2696 * ``'cython'`` : Runs the operation through C-extensions from cython.
…lines 2697–2750 unchanged (54 lines)
2751 engine: Literal["cython", "numba"] | None = None,
2752 engine_kwargs: dict[str, bool] | None = None,
2753 ):
2754 """
2755 Calculate the rolling standard deviation.
2756
2757 This is equivalent to applying ``numpy.std`` (with the specified
2758 ``ddof``) over each rolling window.
2759
2760 Parameters
2761 ----------
2762 ddof : int, default 1
2763 Delta Degrees of Freedom. The divisor used in calculations
2764 is ``N - ddof``, where ``N`` represents the number of elements.
2765
2766 numeric_only : bool, default False
…lines 2767–2827 unchanged (61 lines)
2828 engine: Literal["cython", "numba"] | None = None,
2829 engine_kwargs: dict[str, bool] | None = None,
2830 ):
2831 """
2832 Calculate the rolling variance.
2833
2834 This is equivalent to applying ``numpy.var`` (with the specified
2835 ``ddof``) over each rolling window.
2836
2837 Parameters
2838 ----------
2839 ddof : int, default 1
2840 Delta Degrees of Freedom. The divisor used in calculations
2841 is ``N - ddof``, where ``N`` represents the number of elements.
2842
2843 numeric_only : bool, default False
…lines 2844–2898 unchanged (55 lines)
2899 )
2900
2901 def skew(self, numeric_only: bool = False):
2902 """
2903 Calculate the rolling unbiased skewness.
2904
2905 This is equivalent to applying ``scipy.stats.skew`` over each rolling
2906 window. A minimum of three periods is required.
2907
2908 Parameters
2909 ----------
2910 numeric_only : bool, default False
2911 Include only float, int, boolean columns.
2912
2913 Returns
2914 -------
…lines 2915–2942 unchanged (28 lines)
2943 return super().skew(numeric_only=numeric_only)
2944
2945 def sem(self, ddof: int = 1, numeric_only: bool = False):
2946 """
2947 Calculate the rolling standard error of mean.
2948
2949 This is computed as the rolling standard deviation divided by the
2950 square root of the rolling count. A minimum of one period is required.
2951
2952 Parameters
2953 ----------
2954 ddof : int, default 1
2955 Delta Degrees of Freedom. The divisor used in calculations
2956 is ``N - ddof``, where ``N`` represents the number of elements.
2957
2958 numeric_only : bool, default False
…lines 2959–2990 unchanged (32 lines)
2991 ).pow(0.5)
2992
2993 def kurt(self, numeric_only: bool = False):
2994 """
2995 Calculate the rolling Fisher's definition of kurtosis without bias.
2996
2997 This is equivalent to applying ``scipy.stats.kurtosis`` (with
2998 ``bias=False``) over each rolling window. A minimum of four periods
2999 is required.
3000
3001 Parameters
3002 ----------
3003 numeric_only : bool, default False
3004 Include only float, int, boolean columns.
3005
3006 Returns
3007 -------
…lines 3008–3042 unchanged (35 lines)
3043 return super().kurt(numeric_only=numeric_only)
3044
3045 def first(self, numeric_only: bool = False):
3046 """
3047 Calculate the rolling First (left-most) element of the window.
3048
3049 Return the first observed value in each rolling window. This is useful
3050 for tracking the starting value of a window as it slides forward.
3051
3052 Parameters
3053 ----------
3054 numeric_only : bool, default False
3055 Include only float, int, boolean columns.
3056
3057 Returns
3058 -------
…lines 3059–3080 unchanged (22 lines)
3081 return super().first(numeric_only=numeric_only)
3082
3083 def last(self, numeric_only: bool = False):
3084 """
3085 Calculate the rolling Last (right-most) element of the window.
3086
3087 Return the last observed value in each rolling window. This is useful
3088 for tracking the most recent value of a window as it slides forward.
3089
3090 Parameters
3091 ----------
3092 numeric_only : bool, default False
3093 Include only float, int, boolean columns.
3094
3095 Returns
3096 -------
…lines 3097–3123 unchanged (27 lines)
3124 interpolation: QuantileInterpolation = "linear",
3125 numeric_only: bool = False,
3126 ):
3127 """
3128 Calculate the rolling quantile.
3129
3130 Return the ``q``-th quantile of the values in each rolling window. The
3131 ``interpolation`` parameter controls how quantiles falling between two
3132 data points are handled.
3133
3134 Parameters
3135 ----------
3136 q : float
3137 Quantile to compute. 0 <= quantile <= 1.
3138
3139 interpolation : {'linear', 'lower', 'higher', 'midpoint', 'nearest'}
3140 This optional parameter specifies the interpolation method to use,
…lines 3141–3191 unchanged (51 lines)
3192 pct: bool = False,
3193 numeric_only: bool = False,
3194 ):
3195 """
3196 Calculate the rolling rank.
3197
3198 Compute the rank of each value within each rolling window. Ties are
3199 resolved using the ``method`` parameter.
3200
3201 Parameters
3202 ----------
3203 method : {'average', 'min', 'max'}, default 'average'
3204 How to rank the group of records that have the same value (i.e. ties):
3205
3206 * average: average rank of the group
3207 * min: lowest rank in the group
…lines 3208–3316 unchanged (109 lines)
3317 ddof: int = 1,
3318 numeric_only: bool = False,
3319 ):
3320 """
3321 Calculate the rolling sample covariance.
3322
3323 Compute the sample covariance between the calling object and ``other``
3324 over each rolling window. If ``other`` is not supplied, pairwise
3325 covariances of the columns are computed.
3326
3327 Parameters
3328 ----------
3329 other : Series or DataFrame, optional
3330 If not supplied then will default to self and produce pairwise
3331 output.
3332
3333 pairwise : bool, default None
…lines 3334–3381 unchanged (48 lines)
3382 ddof: int = 1,
3383 numeric_only: bool = False,
3384 ):
3385 """
3386 Calculate the rolling correlation.
3387
3388 Compute the Pearson correlation coefficient between the calling object
3389 and ``other`` over each rolling window. If ``other`` is not supplied,
3390 pairwise correlations of the columns are computed.
3391
3392 Parameters
3393 ----------
3394 other : Series or DataFrame, optional
3395 If not supplied then will default to self and produce pairwise
3396 output.
3397
3398 pairwise : bool, default None
…lines 3399–3576 unchanged (178 lines)

Before

module
expression_statement
string
string_start "\"\"\""
string_content "\nProvide a generic structure to support window functions,\nsi"...
string_end "\"\"\""
future_import_statement
from "from"
__future__ "__future__"
import "import"
dotted_name
identifier "annotations"
import_statement
import "import"
dotted_name
identifier "copy"
import_from_statement
from "from"
dotted_name
identifier "datetime"
import "import"
dotted_name
identifier "timedelta"
import_from_statement
from "from"
dotted_name
identifier "functools"
import "import"
dotted_name
identifier "partial"
import_statement
import "import"
dotted_name
identifier "inspect"
import_from_statement (+31 nodes collapsed)
import_statement
import "import"
aliased_import
dotted_name
identifier "numpy"
as "as"
identifier "np"
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "_libs"
. "."
identifier "tslibs"
import "import"
( "("
dotted_name
identifier "BaseOffset"
, ","
dotted_name
identifier "Timedelta"
, ","
dotted_name
identifier "to_offset"
, ","
) ")"
import_statement
import "import"
aliased_import
dotted_name
identifier "pandas"
. "."
identifier "_libs"
. "."
identifier "window"
. "."
identifier "aggregations"
as "as"
identifier "window_aggregations"
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "compat"
. "."
identifier "_optional"
import "import"
dotted_name
identifier "import_optional_dependency"
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "errors"
import "import"
dotted_name
identifier "DataError"
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "util"
. "."
identifier "_decorators"
import "import"
dotted_name
identifier "set_module"
import_from_statement (+28 nodes collapsed)
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "dtypes"
. "."
identifier "dtypes"
import "import"
dotted_name
identifier "ArrowDtype"
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "dtypes"
. "."
identifier "generic"
import "import"
( "("
dotted_name
identifier "ABCDataFrame"
, ","
dotted_name
identifier "ABCSeries"
, ","
) ")"
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "dtypes"
. "."
identifier "missing"
import "import"
dotted_name
identifier "notna"
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "_numba"
import "import"
dotted_name
identifier "executor"
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "algorithms"
import "import"
dotted_name
identifier "factorize"
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "apply"
import "import"
( "("
dotted_name
identifier "ResamplerWindowApply"
, ","
dotted_name
identifier "reconstruct_func"
, ","
) ")"
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "arrays"
import "import"
dotted_name
identifier "ExtensionArray"
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "base"
import "import"
dotted_name
identifier "SelectionMixin"
import_statement
import "import"
aliased_import
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "common"
as "as"
identifier "com"
import_from_statement (+25 nodes collapsed)
import_from_statement (+28 nodes collapsed)
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "reshape"
. "."
identifier "concat"
import "import"
dotted_name
identifier "concat"
import_from_statement (+22 nodes collapsed)
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "window"
. "."
identifier "common"
import "import"
( "("
dotted_name
identifier "flex_binary_moment"
, ","
dotted_name
identifier "zsqrt"
, ","
) ")"
import_from_statement (+22 nodes collapsed)
if_statement (+102 nodes collapsed)
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "arrays"
. "."
identifier "datetimelike"
import "import"
dotted_name
identifier "dtype_to_unit"
class_definition (+4624 nodes collapsed)
class_definition (+1673 nodes collapsed)
decorated_definition (+1091 nodes collapsed)
class_definition (+3773 nodes collapsed)
decorated_definition
decorator
@ "@"
call
identifier "set_module"
argument_list
( "("
string
string_start "\""
string_content "pandas.api.typing"
string_end "\""
) ")"
class_definition
class "class"
identifier "Rolling"
argument_list
( "("
identifier "RollingAndExpandingMixin"
) ")"
: ":"
block
expression_statement (+56 nodes collapsed)
function_definition (+418 nodes collapsed)
function_definition (+79 nodes collapsed)
function_definition (+58 nodes collapsed)
function_definition
def "def"
identifier "aggregate"
parameters
( "("
identifier "self"
, ","
default_parameter
identifier "func"
= "="
none "None"
, ","
list_splat_pattern
* "*"
identifier "args"
, ","
dictionary_splat_pattern
** "**"
identifier "kwargs"
) ")"
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Aggregate using one or more operations over the spe"...
string_end "\"\"\""
return_statement (+23 nodes collapsed)
expression_statement
assignment
identifier "agg"
= "="
identifier "aggregate"
function_definition
def "def"
identifier "count"
parameters
( "("
identifier "self"
, ","
typed_default_parameter
identifier "numeric_only"
: ":"
type
identifier "bool"
= "="
false "False"
) ")"
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling count of non NaN observations"...
string_end "\"\"\""
return_statement
return "return"
call
attribute
call
identifier "super"
argument_list
( "("
) ")"
. "."
identifier "count"
argument_list
( "("
identifier "numeric_only"
) ")"
function_definition
def "def"
identifier "apply"
parameters (+122 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling custom aggregation function.\n"...
string_end "\"\"\""
return_statement (+41 nodes collapsed)
decorated_definition (+65 nodes collapsed)
decorated_definition (+59 nodes collapsed)
decorated_definition (+108 nodes collapsed)
function_definition
def "def"
identifier "sum"
parameters (+63 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling sum.\n\n Parameters\n "...
string_end "\"\"\""
return_statement (+29 nodes collapsed)
function_definition
def "def"
identifier "max"
parameters (+71 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling maximum.\n\n Parameters\n"...
string_end "\"\"\""
return_statement (+29 nodes collapsed)
function_definition
def "def"
identifier "min"
parameters (+63 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling minimum.\n\n Parameters\n"...
string_end "\"\"\""
return_statement (+29 nodes collapsed)
function_definition
def "def"
identifier "mean"
parameters (+63 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling mean.\n\n Parameters\n "...
string_end "\"\"\""
return_statement (+29 nodes collapsed)
function_definition
def "def"
identifier "median"
parameters (+63 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling median.\n\n Parameters\n "...
string_end "\"\"\""
return_statement (+29 nodes collapsed)
function_definition
def "def"
identifier "std"
parameters (+71 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling standard deviation.\n\n "...
string_end "\"\"\""
return_statement (+34 nodes collapsed)
function_definition
def "def"
identifier "var"
parameters (+71 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling variance.\n\n Parameters"...
string_end "\"\"\""
return_statement (+34 nodes collapsed)
function_definition
def "def"
identifier "skew"
parameters
( "("
identifier "self"
, ","
typed_default_parameter
identifier "numeric_only"
: ":"
type
identifier "bool"
= "="
false "False"
) ")"
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling unbiased skewness.\n\n P"...
string_end "\"\"\""
return_statement
return "return"
call
attribute
call
identifier "super"
argument_list
( "("
) ")"
. "."
identifier "skew"
argument_list
( "("
keyword_argument
identifier "numeric_only"
= "="
identifier "numeric_only"
) ")"
function_definition
def "def"
identifier "sem"
parameters
( "("
identifier "self"
, ","
typed_default_parameter
identifier "ddof"
: ":"
type
identifier "int"
= "="
integer "1"
, ","
typed_default_parameter
identifier "numeric_only"
: ":"
type
identifier "bool"
= "="
false "False"
) ")"
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling standard error of mean.\n\n "...
string_end "\"\"\""
comment "# Raise here so error message says sem instead of std"
expression_statement
call
attribute
identifier "self"
. "."
identifier "_validate_numeric_only"
argument_list
( "("
string
string_start "\""
string_content "sem"
string_end "\""
, ","
identifier "numeric_only"
) ")"
return_statement (+41 nodes collapsed)
function_definition
def "def"
identifier "kurt"
parameters
( "("
identifier "self"
, ","
typed_default_parameter
identifier "numeric_only"
: ":"
type
identifier "bool"
= "="
false "False"
) ")"
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling Fisher's definition of kurtos"...
string_end "\"\"\""
return_statement
return "return"
call
attribute
call
identifier "super"
argument_list
( "("
) ")"
. "."
identifier "kurt"
argument_list
( "("
keyword_argument
identifier "numeric_only"
= "="
identifier "numeric_only"
) ")"
function_definition
def "def"
identifier "first"
parameters
( "("
identifier "self"
, ","
typed_default_parameter
identifier "numeric_only"
: ":"
type
identifier "bool"
= "="
false "False"
) ")"
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling First (left-most) element of "...
string_end "\"\"\""
return_statement
return "return"
call
attribute
call
identifier "super"
argument_list
( "("
) ")"
. "."
identifier "first"
argument_list
( "("
keyword_argument
identifier "numeric_only"
= "="
identifier "numeric_only"
) ")"
function_definition
def "def"
identifier "last"
parameters
( "("
identifier "self"
, ","
typed_default_parameter
identifier "numeric_only"
: ":"
type
identifier "bool"
= "="
false "False"
) ")"
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling Last (right-most) element of "...
string_end "\"\"\""
return_statement
return "return"
call
attribute
call
identifier "super"
argument_list
( "("
) ")"
. "."
identifier "last"
argument_list
( "("
keyword_argument
identifier "numeric_only"
= "="
identifier "numeric_only"
) ")"
function_definition
def "def"
identifier "quantile"
parameters (+30 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling quantile.\n\n Parameters"...
string_end "\"\"\""
return_statement (+29 nodes collapsed)
function_definition
def "def"
identifier "rank"
parameters (+40 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling rank.\n\n Parameters\n "...
string_end "\"\"\""
return_statement (+34 nodes collapsed)
function_definition (+42 nodes collapsed)
function_definition
def "def"
identifier "cov"
parameters (+46 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling sample covariance.\n\n P"...
string_end "\"\"\""
return_statement (+34 nodes collapsed)
function_definition
def "def"
identifier "corr"
parameters (+46 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling correlation.\n\n Paramet"...
string_end "\"\"\""
return_statement (+34 nodes collapsed)
expression_statement
assignment
attribute
identifier "Rolling"
. "."
identifier "__doc__"
= "="
attribute
identifier "Window"
. "."
identifier "__doc__"
decorated_definition (+416 nodes collapsed)

After

module
expression_statement
string
string_start "\"\"\""
string_content "\nProvide a generic structure to support window functions,\nsi"...
string_end "\"\"\""
future_import_statement
from "from"
__future__ "__future__"
import "import"
dotted_name
identifier "annotations"
import_statement
import "import"
dotted_name
identifier "copy"
import_from_statement
from "from"
dotted_name
identifier "datetime"
import "import"
dotted_name
identifier "timedelta"
import_from_statement
from "from"
dotted_name
identifier "functools"
import "import"
dotted_name
identifier "partial"
import_statement
import "import"
dotted_name
identifier "inspect"
import_from_statement (+31 nodes collapsed)
import_statement
import "import"
aliased_import
dotted_name
identifier "numpy"
as "as"
identifier "np"
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "_libs"
. "."
identifier "tslibs"
import "import"
( "("
dotted_name
identifier "BaseOffset"
, ","
dotted_name
identifier "Timedelta"
, ","
dotted_name
identifier "to_offset"
, ","
) ")"
import_statement
import "import"
aliased_import
dotted_name
identifier "pandas"
. "."
identifier "_libs"
. "."
identifier "window"
. "."
identifier "aggregations"
as "as"
identifier "window_aggregations"
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "compat"
. "."
identifier "_optional"
import "import"
dotted_name
identifier "import_optional_dependency"
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "errors"
import "import"
dotted_name
identifier "DataError"
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "util"
. "."
identifier "_decorators"
import "import"
dotted_name
identifier "set_module"
import_from_statement (+28 nodes collapsed)
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "dtypes"
. "."
identifier "dtypes"
import "import"
dotted_name
identifier "ArrowDtype"
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "dtypes"
. "."
identifier "generic"
import "import"
( "("
dotted_name
identifier "ABCDataFrame"
, ","
dotted_name
identifier "ABCSeries"
, ","
) ")"
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "dtypes"
. "."
identifier "missing"
import "import"
dotted_name
identifier "notna"
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "_numba"
import "import"
dotted_name
identifier "executor"
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "algorithms"
import "import"
dotted_name
identifier "factorize"
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "apply"
import "import"
( "("
dotted_name
identifier "ResamplerWindowApply"
, ","
dotted_name
identifier "reconstruct_func"
, ","
) ")"
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "arrays"
import "import"
dotted_name
identifier "ExtensionArray"
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "base"
import "import"
dotted_name
identifier "SelectionMixin"
import_statement
import "import"
aliased_import
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "common"
as "as"
identifier "com"
import_from_statement (+25 nodes collapsed)
import_from_statement (+28 nodes collapsed)
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "reshape"
. "."
identifier "concat"
import "import"
dotted_name
identifier "concat"
import_from_statement (+22 nodes collapsed)
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "window"
. "."
identifier "common"
import "import"
( "("
dotted_name
identifier "flex_binary_moment"
, ","
dotted_name
identifier "zsqrt"
, ","
) ")"
import_from_statement (+22 nodes collapsed)
if_statement (+102 nodes collapsed)
import_from_statement
from "from"
dotted_name
identifier "pandas"
. "."
identifier "core"
. "."
identifier "arrays"
. "."
identifier "datetimelike"
import "import"
dotted_name
identifier "dtype_to_unit"
class_definition (+4624 nodes collapsed)
class_definition (+1673 nodes collapsed)
decorated_definition (+1091 nodes collapsed)
class_definition (+3773 nodes collapsed)
decorated_definition
decorator
@ "@"
call
identifier "set_module"
argument_list
( "("
string
string_start "\""
string_content "pandas.api.typing"
string_end "\""
) ")"
class_definition
class "class"
identifier "Rolling"
argument_list
( "("
identifier "RollingAndExpandingMixin"
) ")"
: ":"
block
expression_statement (+56 nodes collapsed)
function_definition (+418 nodes collapsed)
function_definition (+79 nodes collapsed)
function_definition (+58 nodes collapsed)
function_definition
def "def"
identifier "aggregate"
parameters
( "("
identifier "self"
, ","
default_parameter
identifier "func"
= "="
none "None"
, ","
list_splat_pattern
* "*"
identifier "args"
, ","
dictionary_splat_pattern
** "**"
identifier "kwargs"
) ")"
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Aggregate using one or more operations over the spe"...
string_end "\"\"\""
return_statement (+23 nodes collapsed)
expression_statement
assignment
identifier "agg"
= "="
identifier "aggregate"
function_definition
def "def"
identifier "count"
parameters
( "("
identifier "self"
, ","
typed_default_parameter
identifier "numeric_only"
: ":"
type
identifier "bool"
= "="
false "False"
) ")"
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling count of non NaN observations"...
string_end "\"\"\""
return_statement
return "return"
call
attribute
call
identifier "super"
argument_list
( "("
) ")"
. "."
identifier "count"
argument_list
( "("
identifier "numeric_only"
) ")"
function_definition
def "def"
identifier "apply"
parameters (+122 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling custom aggregation function.\n"...
string_end "\"\"\""
return_statement (+41 nodes collapsed)
decorated_definition (+65 nodes collapsed)
decorated_definition (+59 nodes collapsed)
decorated_definition (+108 nodes collapsed)
function_definition
def "def"
identifier "sum"
parameters (+63 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling sum.\n\n This is equival"...
string_end "\"\"\""
return_statement (+29 nodes collapsed)
function_definition
def "def"
identifier "max"
parameters (+71 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling maximum.\n\n This is equ"...
string_end "\"\"\""
return_statement (+29 nodes collapsed)
function_definition
def "def"
identifier "min"
parameters (+63 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling minimum.\n\n This is equ"...
string_end "\"\"\""
return_statement (+29 nodes collapsed)
function_definition
def "def"
identifier "mean"
parameters (+63 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling mean.\n\n This is equiva"...
string_end "\"\"\""
return_statement (+29 nodes collapsed)
function_definition
def "def"
identifier "median"
parameters (+63 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling median.\n\n This is equi"...
string_end "\"\"\""
return_statement (+29 nodes collapsed)
function_definition
def "def"
identifier "std"
parameters (+71 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling standard deviation.\n\n "...
string_end "\"\"\""
return_statement (+34 nodes collapsed)
function_definition
def "def"
identifier "var"
parameters (+71 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling variance.\n\n This is eq"...
string_end "\"\"\""
return_statement (+34 nodes collapsed)
function_definition
def "def"
identifier "skew"
parameters
( "("
identifier "self"
, ","
typed_default_parameter
identifier "numeric_only"
: ":"
type
identifier "bool"
= "="
false "False"
) ")"
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling unbiased skewness.\n\n T"...
string_end "\"\"\""
return_statement
return "return"
call
attribute
call
identifier "super"
argument_list
( "("
) ")"
. "."
identifier "skew"
argument_list
( "("
keyword_argument
identifier "numeric_only"
= "="
identifier "numeric_only"
) ")"
function_definition
def "def"
identifier "sem"
parameters
( "("
identifier "self"
, ","
typed_default_parameter
identifier "ddof"
: ":"
type
identifier "int"
= "="
integer "1"
, ","
typed_default_parameter
identifier "numeric_only"
: ":"
type
identifier "bool"
= "="
false "False"
) ")"
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling standard error of mean.\n\n "...
string_end "\"\"\""
comment "# Raise here so error message says sem instead of std"
expression_statement
call
attribute
identifier "self"
. "."
identifier "_validate_numeric_only"
argument_list
( "("
string
string_start "\""
string_content "sem"
string_end "\""
, ","
identifier "numeric_only"
) ")"
return_statement (+41 nodes collapsed)
function_definition
def "def"
identifier "kurt"
parameters
( "("
identifier "self"
, ","
typed_default_parameter
identifier "numeric_only"
: ":"
type
identifier "bool"
= "="
false "False"
) ")"
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling Fisher's definition of kurtos"...
string_end "\"\"\""
return_statement
return "return"
call
attribute
call
identifier "super"
argument_list
( "("
) ")"
. "."
identifier "kurt"
argument_list
( "("
keyword_argument
identifier "numeric_only"
= "="
identifier "numeric_only"
) ")"
function_definition
def "def"
identifier "first"
parameters
( "("
identifier "self"
, ","
typed_default_parameter
identifier "numeric_only"
: ":"
type
identifier "bool"
= "="
false "False"
) ")"
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling First (left-most) element of "...
string_end "\"\"\""
return_statement
return "return"
call
attribute
call
identifier "super"
argument_list
( "("
) ")"
. "."
identifier "first"
argument_list
( "("
keyword_argument
identifier "numeric_only"
= "="
identifier "numeric_only"
) ")"
function_definition
def "def"
identifier "last"
parameters
( "("
identifier "self"
, ","
typed_default_parameter
identifier "numeric_only"
: ":"
type
identifier "bool"
= "="
false "False"
) ")"
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling Last (right-most) element of "...
string_end "\"\"\""
return_statement
return "return"
call
attribute
call
identifier "super"
argument_list
( "("
) ")"
. "."
identifier "last"
argument_list
( "("
keyword_argument
identifier "numeric_only"
= "="
identifier "numeric_only"
) ")"
function_definition
def "def"
identifier "quantile"
parameters (+30 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling quantile.\n\n Return the"...
string_end "\"\"\""
return_statement (+29 nodes collapsed)
function_definition
def "def"
identifier "rank"
parameters (+40 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling rank.\n\n Compute the ra"...
string_end "\"\"\""
return_statement (+34 nodes collapsed)
function_definition (+42 nodes collapsed)
function_definition
def "def"
identifier "cov"
parameters (+46 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling sample covariance.\n\n C"...
string_end "\"\"\""
return_statement (+34 nodes collapsed)
function_definition
def "def"
identifier "corr"
parameters (+46 nodes collapsed)
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n Calculate the rolling correlation.\n\n Compute"...
string_end "\"\"\""
return_statement (+34 nodes collapsed)
expression_statement
assignment
attribute
identifier "Rolling"
. "."
identifier "__doc__"
= "="
attribute
identifier "Window"
. "."
identifier "__doc__"
decorated_definition (+416 nodes collapsed)