@@ -10515,6 +10515,60 @@ def _doc_parms(cls):
10515
10515
%(examples)s
10516
10516
"""
10517
10517
10518
+ _num_ddof_doc = """
10519
+ %(desc)s
10520
+ Parameters
10521
+ ----------
10522
+ axis : %(axis_descr)s
10523
+ skipna : bool, default True
10524
+ Exclude NA/null values. If an entire row/column is NA, the result
10525
+ will be NA.
10526
+ level : int or level name, default None
10527
+ If the axis is a MultiIndex (hierarchical), count along a
10528
+ particular level, collapsing into a %(name1)s.
10529
+ ddof : int, default 1
10530
+ Delta Degrees of Freedom. The divisor used in calculations is N - ddof,
10531
+ where N represents the number of elements.
10532
+ numeric_only : bool, default None
10533
+ Include only float, int, boolean columns. If None, will attempt to use
10534
+ everything, then use only numeric data. Not implemented for Series.
10535
+ Returns
10536
+ -------
10537
+ %(name1)s or %(name2)s (if level specified)\n """
10538
+
10539
+ _bool_doc = """
10540
+ %(desc)s
10541
+ Parameters
10542
+ ----------
10543
+ axis : {0 or 'index', 1 or 'columns', None}, default 0
10544
+ Indicate which axis or axes should be reduced.
10545
+ * 0 / 'index' : reduce the index, return a Series whose index is the
10546
+ original column labels.
10547
+ * 1 / 'columns' : reduce the columns, return a Series whose index is the
10548
+ original index.
10549
+ * None : reduce all axes, return a scalar.
10550
+ bool_only : bool, default None
10551
+ Include only boolean columns. If None, will attempt to use everything,
10552
+ then use only boolean data. Not implemented for Series.
10553
+ skipna : bool, default True
10554
+ Exclude NA/null values. If the entire row/column is NA and skipna is
10555
+ True, then the result will be %(empty_value)s, as for an empty row/column.
10556
+ If skipna is False, then NA are treated as True, because these are not
10557
+ equal to zero.
10558
+ level : int or level name, default None
10559
+ If the axis is a MultiIndex (hierarchical), count along a
10560
+ particular level, collapsing into a %(name1)s.
10561
+ **kwargs : any, default None
10562
+ Additional keywords have no effect but might be accepted for
10563
+ compatibility with NumPy.
10564
+ Returns
10565
+ -------
10566
+ %(name1)s or %(name2)s
10567
+ If level is specified, then, %(name2)s is returned; otherwise, %(name1)s
10568
+ is returned.
10569
+ %(see_also)s
10570
+ %(examples)s"""
10571
+
10518
10572
_all_desc = """\
10519
10573
Return whether all elements are True, potentially over an axis.
10520
10574
@@ -10575,6 +10629,36 @@ def _doc_parms(cls):
10575
10629
DataFrame.any : Return True if one (or more) elements are True.
10576
10630
"""
10577
10631
10632
+ _cnum_doc = """
10633
+ Return cumulative %(desc)s over a DataFrame or Series axis.
10634
+ Returns a DataFrame or Series of the same size containing the cumulative
10635
+ %(desc)s.
10636
+ Parameters
10637
+ ----------
10638
+ axis : {0 or 'index', 1 or 'columns'}, default 0
10639
+ The index or the name of the axis. 0 is equivalent to None or 'index'.
10640
+ skipna : bool, default True
10641
+ Exclude NA/null values. If an entire row/column is NA, the result
10642
+ will be NA.
10643
+ *args, **kwargs
10644
+ Additional keywords have no effect but might be accepted for
10645
+ compatibility with NumPy.
10646
+ Returns
10647
+ -------
10648
+ %(name1)s or %(name2)s
10649
+ Return cumulative %(desc)s of %(name1)s or %(name2)s.
10650
+ See Also
10651
+ --------
10652
+ core.window.Expanding.%(accum_func_name)s : Similar functionality
10653
+ but ignores ``NaN`` values.
10654
+ %(name2)s.%(accum_func_name)s : Return the %(desc)s over
10655
+ %(name2)s axis.
10656
+ %(name2)s.cummax : Return cumulative maximum over %(name2)s axis.
10657
+ %(name2)s.cummin : Return cumulative minimum over %(name2)s axis.
10658
+ %(name2)s.cumsum : Return cumulative sum over %(name2)s axis.
10659
+ %(name2)s.cumprod : Return cumulative product over %(name2)s axis.
10660
+ %(examples)s"""
10661
+
10578
10662
_cummin_examples = """\
10579
10663
Examples
10580
10664
--------
@@ -11143,32 +11227,11 @@ def stat_func(
11143
11227
def _make_stat_function_ddof (
11144
11228
cls , name : str , name1 : str , name2 : str , axis_descr : str , desc : str , func : Callable
11145
11229
) -> Callable :
11146
- @doc (desc = desc , name1 = name1 , name2 = name2 , axis_descr = axis_descr )
11230
+ @Substitution (desc = desc , name1 = name1 , name2 = name2 , axis_descr = axis_descr )
11231
+ @Appender (_num_ddof_doc )
11147
11232
def stat_func (
11148
11233
self , axis = None , skipna = None , level = None , ddof = 1 , numeric_only = None , ** kwargs
11149
11234
):
11150
- """
11151
- {desc}
11152
-
11153
- Parameters
11154
- ----------
11155
- axis : {axis_descr}
11156
- skipna : bool, default True
11157
- Exclude NA/null values. If an entire row/column is NA, the result
11158
- will be NA.
11159
- level : int or level name, default None
11160
- If the axis is a MultiIndex (hierarchical), count along a
11161
- particular level, collapsing into a %(name1)s.
11162
- ddof : int, default 1
11163
- Delta Degrees of Freedom. The divisor used in calculations is N - ddof,
11164
- where N represents the number of elements.
11165
- numeric_only : bool, default None
11166
- Include only float, int, boolean columns. If None, will attempt to use
11167
- everything, then use only numeric data. Not implemented for Series.
11168
-
11169
- Returns
11170
- -------
11171
- {name1} or {name2} (if level specified)\n """
11172
11235
nv .validate_stat_ddof_func (tuple (), kwargs , fname = name )
11173
11236
if skipna is None :
11174
11237
skipna = True
@@ -11196,48 +11259,16 @@ def _make_cum_function(
11196
11259
accum_func_name : str ,
11197
11260
examples : str ,
11198
11261
) -> Callable :
11199
- @doc (
11262
+ @Substitution (
11200
11263
desc = desc ,
11201
11264
name1 = name1 ,
11202
11265
name2 = name2 ,
11266
+ axis_descr = axis_descr ,
11203
11267
accum_func_name = accum_func_name ,
11204
11268
examples = examples ,
11205
11269
)
11270
+ @Appender (_cnum_doc )
11206
11271
def cum_func (self , axis = None , skipna = True , * args , ** kwargs ):
11207
- """
11208
- Return cumulative {desc} over a DataFrame or Series axis.
11209
-
11210
- Returns a DataFrame or Series of the same size containing the cumulative
11211
- {desc}.
11212
-
11213
- Parameters
11214
- ----------
11215
- axis : {{0 or 'index', 1 or 'columns'}}, default 0
11216
- The index or the name of the axis. 0 is equivalent to None or 'index'.
11217
- skipna : bool, default True
11218
- Exclude NA/null values. If an entire row/column is NA, the result
11219
- will be NA.
11220
- *args, **kwargs
11221
- Additional keywords have no effect but might be accepted for
11222
- compatibility with NumPy.
11223
-
11224
- Returns
11225
- -------
11226
- {name1} or {name2}
11227
- Return cumulative {desc} of {name1} or {name2}.
11228
-
11229
- See Also
11230
- --------
11231
- core.window.Expanding.{accum_func_name} : Similar functionality
11232
- but ignores ``NaN`` values.
11233
- {name2}.{accum_func_name} : Return the {desc} over
11234
- {name2} axis.
11235
- {name2}.cummax : Return cumulative maximum over {name2} axis.
11236
- {name2}.cummin : Return cumulative minimum over {name2} axis.
11237
- {name2}.cumsum : Return cumulative sum over {name2} axis.
11238
- {name2}.cumprod : Return cumulative product over {name2} axis.
11239
-
11240
- {examples}"""
11241
11272
skipna = nv .validate_cum_func_with_skipna (skipna , args , kwargs , name )
11242
11273
if axis is None :
11243
11274
axis = self ._stat_axis_number
@@ -11274,52 +11305,17 @@ def _make_logical_function(
11274
11305
examples : str ,
11275
11306
empty_value : bool ,
11276
11307
) -> Callable :
11277
- @doc (
11308
+ @Substitution (
11278
11309
desc = desc ,
11279
11310
name1 = name1 ,
11280
11311
name2 = name2 ,
11312
+ axis_descr = axis_descr ,
11281
11313
see_also = see_also ,
11282
11314
examples = examples ,
11283
- empty_value = str ( empty_value ) ,
11315
+ empty_value = empty_value ,
11284
11316
)
11317
+ @Appender (_bool_doc )
11285
11318
def logical_func (self , axis = 0 , bool_only = None , skipna = True , level = None , ** kwargs ):
11286
- """
11287
- {desc}
11288
-
11289
- Parameters
11290
- ----------
11291
- axis : {{0 or 'index', 1 or 'columns', None}}, default 0
11292
- Indicate which axis or axes should be reduced.
11293
-
11294
- * 0 / 'index' : reduce the index, return a Series whose index is the
11295
- original column labels.
11296
- * 1 / 'columns' : reduce the columns, return a Series whose index is the
11297
- original index.
11298
- * None : reduce all axes, return a scalar.
11299
-
11300
- bool_only : bool, default None
11301
- Include only boolean columns. If None, will attempt to use everything,
11302
- then use only boolean data. Not implemented for Series.
11303
- skipna : bool, default True
11304
- Exclude NA/null values. If the entire row/column is NA and skipna is
11305
- True, then the result will be {empty_value}, as for an empty row/column.
11306
- If skipna is False, then NA are treated as True, because these are not
11307
- equal to zero.
11308
- level : int or level name, default None
11309
- If the axis is a MultiIndex (hierarchical), count along a
11310
- particular level, collapsing into a {name1}.
11311
- **kwargs : any, default None
11312
- Additional keywords have no effect but might be accepted for
11313
- compatibility with NumPy.
11314
-
11315
- Returns
11316
- -------
11317
- {name1} or {name2}
11318
- If level is specified, then, {name2} is returned; otherwise, {name1}
11319
- is returned.
11320
-
11321
- {see_also}
11322
- {examples}"""
11323
11319
nv .validate_logical_func (tuple (), kwargs , fname = name )
11324
11320
if level is not None :
11325
11321
if bool_only is not None :
0 commit comments