@@ -351,6 +351,46 @@ class providing the base-class of operations.
351
351
{example}
352
352
"""
353
353
354
+ _groupby_agg_method_engine_template = """
355
+ Compute {fname} of group values.
356
+
357
+ Parameters
358
+ ----------
359
+ numeric_only : bool, default {no}
360
+ Include only float, int, boolean columns.
361
+
362
+ .. versionchanged:: 2.0.0
363
+
364
+ numeric_only no longer accepts ``None``.
365
+
366
+ min_count : int, default {mc}
367
+ The required number of valid values to perform the operation. If fewer
368
+ than ``min_count`` non-NA values are present the result will be NA.
369
+
370
+ engine : str, default None {e}
371
+ * ``'cython'`` : Runs rolling apply through C-extensions from cython.
372
+ * ``'numba'`` : Runs rolling apply through JIT compiled code from numba.
373
+ Only available when ``raw`` is set to ``True``.
374
+ * ``None`` : Defaults to ``'cython'`` or globally setting ``compute.use_numba``
375
+
376
+ engine_kwargs : dict, default None {ek}
377
+ * For ``'cython'`` engine, there are no accepted ``engine_kwargs``
378
+ * For ``'numba'`` engine, the engine can accept ``nopython``, ``nogil``
379
+ and ``parallel`` dictionary keys. The values must either be ``True`` or
380
+ ``False``. The default ``engine_kwargs`` for the ``'numba'`` engine is
381
+ ``{{'nopython': True, 'nogil': False, 'parallel': False}}`` and will be
382
+ applied to both the ``func`` and the ``apply`` groupby aggregation.
383
+
384
+ Returns
385
+ -------
386
+ Series or DataFrame
387
+ Computed {fname} of values within each group.
388
+
389
+ Examples
390
+ --------
391
+ {example}
392
+ """
393
+
354
394
_pipe_template = """
355
395
Apply a ``func`` with arguments to this %(klass)s object and return its result.
356
396
@@ -2231,7 +2271,7 @@ def hfunc(bvalues: ArrayLike) -> ArrayLike:
2231
2271
def mean (
2232
2272
self ,
2233
2273
numeric_only : bool = False ,
2234
- engine : str = "cython" ,
2274
+ engine : Literal [ "cython" , "numba" ] | None = None ,
2235
2275
engine_kwargs : dict [str , bool ] | None = None ,
2236
2276
):
2237
2277
"""
@@ -2402,7 +2442,7 @@ def median(self, numeric_only: bool = False):
2402
2442
def std (
2403
2443
self ,
2404
2444
ddof : int = 1 ,
2405
- engine : str | None = None ,
2445
+ engine : Literal [ "cython" , "numba" ] | None = None ,
2406
2446
engine_kwargs : dict [str , bool ] | None = None ,
2407
2447
numeric_only : bool = False ,
2408
2448
):
@@ -2511,7 +2551,7 @@ def std(
2511
2551
def var (
2512
2552
self ,
2513
2553
ddof : int = 1 ,
2514
- engine : str | None = None ,
2554
+ engine : Literal [ "cython" , "numba" ] | None = None ,
2515
2555
engine_kwargs : dict [str , bool ] | None = None ,
2516
2556
numeric_only : bool = False ,
2517
2557
):
@@ -2909,10 +2949,12 @@ def size(self) -> DataFrame | Series:
2909
2949
2910
2950
@final
2911
2951
@doc (
2912
- _groupby_agg_method_template ,
2952
+ _groupby_agg_method_engine_template ,
2913
2953
fname = "sum" ,
2914
2954
no = False ,
2915
2955
mc = 0 ,
2956
+ e = None ,
2957
+ ek = None ,
2916
2958
example = dedent (
2917
2959
"""\
2918
2960
For SeriesGroupBy:
@@ -2952,7 +2994,7 @@ def sum(
2952
2994
self ,
2953
2995
numeric_only : bool = False ,
2954
2996
min_count : int = 0 ,
2955
- engine : str | None = None ,
2997
+ engine : Literal [ "cython" , "numba" ] | None = None ,
2956
2998
engine_kwargs : dict [str , bool ] | None = None ,
2957
2999
):
2958
3000
if maybe_use_numba (engine ):
@@ -3026,10 +3068,12 @@ def prod(self, numeric_only: bool = False, min_count: int = 0):
3026
3068
3027
3069
@final
3028
3070
@doc (
3029
- _groupby_agg_method_template ,
3071
+ _groupby_agg_method_engine_template ,
3030
3072
fname = "min" ,
3031
3073
no = False ,
3032
3074
mc = - 1 ,
3075
+ e = None ,
3076
+ ek = None ,
3033
3077
example = dedent (
3034
3078
"""\
3035
3079
For SeriesGroupBy:
@@ -3069,7 +3113,7 @@ def min(
3069
3113
self ,
3070
3114
numeric_only : bool = False ,
3071
3115
min_count : int = - 1 ,
3072
- engine : str | None = None ,
3116
+ engine : Literal [ "cython" , "numba" ] | None = None ,
3073
3117
engine_kwargs : dict [str , bool ] | None = None ,
3074
3118
):
3075
3119
if maybe_use_numba (engine ):
@@ -3092,10 +3136,12 @@ def min(
3092
3136
3093
3137
@final
3094
3138
@doc (
3095
- _groupby_agg_method_template ,
3139
+ _groupby_agg_method_engine_template ,
3096
3140
fname = "max" ,
3097
3141
no = False ,
3098
3142
mc = - 1 ,
3143
+ e = None ,
3144
+ ek = None ,
3099
3145
example = dedent (
3100
3146
"""\
3101
3147
For SeriesGroupBy:
@@ -3135,7 +3181,7 @@ def max(
3135
3181
self ,
3136
3182
numeric_only : bool = False ,
3137
3183
min_count : int = - 1 ,
3138
- engine : str | None = None ,
3184
+ engine : Literal [ "cython" , "numba" ] | None = None ,
3139
3185
engine_kwargs : dict [str , bool ] | None = None ,
3140
3186
):
3141
3187
if maybe_use_numba (engine ):
0 commit comments