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