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