@@ -10624,6 +10624,60 @@ def _doc_parms(cls):
10624
10624
%(examples)s
10625
10625
"""
10626
10626
10627
+ _num_ddof_doc = """
10628
+ %(desc)s
10629
+ Parameters
10630
+ ----------
10631
+ axis : %(axis_descr)s
10632
+ skipna : bool, default True
10633
+ Exclude NA/null values. If an entire row/column is NA, the result
10634
+ will be NA.
10635
+ level : int or level name, default None
10636
+ If the axis is a MultiIndex (hierarchical), count along a
10637
+ particular level, collapsing into a %(name1)s.
10638
+ ddof : int, default 1
10639
+ Delta Degrees of Freedom. The divisor used in calculations is N - ddof,
10640
+ where N represents the number of elements.
10641
+ numeric_only : bool, default None
10642
+ Include only float, int, boolean columns. If None, will attempt to use
10643
+ everything, then use only numeric data. Not implemented for Series.
10644
+ Returns
10645
+ -------
10646
+ %(name1)s or %(name2)s (if level specified)\n """
10647
+
10648
+ _bool_doc = """
10649
+ %(desc)s
10650
+ Parameters
10651
+ ----------
10652
+ axis : {0 or 'index', 1 or 'columns', None}, default 0
10653
+ Indicate which axis or axes should be reduced.
10654
+ * 0 / 'index' : reduce the index, return a Series whose index is the
10655
+ original column labels.
10656
+ * 1 / 'columns' : reduce the columns, return a Series whose index is the
10657
+ original index.
10658
+ * None : reduce all axes, return a scalar.
10659
+ bool_only : bool, default None
10660
+ Include only boolean columns. If None, will attempt to use everything,
10661
+ then use only boolean data. Not implemented for Series.
10662
+ skipna : bool, default True
10663
+ Exclude NA/null values. If the entire row/column is NA and skipna is
10664
+ True, then the result will be %(empty_value)s, as for an empty row/column.
10665
+ If skipna is False, then NA are treated as True, because these are not
10666
+ equal to zero.
10667
+ level : int or level name, default None
10668
+ If the axis is a MultiIndex (hierarchical), count along a
10669
+ particular level, collapsing into a %(name1)s.
10670
+ **kwargs : any, default None
10671
+ Additional keywords have no effect but might be accepted for
10672
+ compatibility with NumPy.
10673
+ Returns
10674
+ -------
10675
+ %(name1)s or %(name2)s
10676
+ If level is specified, then, %(name2)s is returned; otherwise, %(name1)s
10677
+ is returned.
10678
+ %(see_also)s
10679
+ %(examples)s"""
10680
+
10627
10681
_all_desc = """\
10628
10682
Return whether all elements are True, potentially over an axis.
10629
10683
@@ -10684,6 +10738,36 @@ def _doc_parms(cls):
10684
10738
DataFrame.any : Return True if one (or more) elements are True.
10685
10739
"""
10686
10740
10741
+ _cnum_doc = """
10742
+ Return cumulative %(desc)s over a DataFrame or Series axis.
10743
+ Returns a DataFrame or Series of the same size containing the cumulative
10744
+ %(desc)s.
10745
+ Parameters
10746
+ ----------
10747
+ axis : {0 or 'index', 1 or 'columns'}, default 0
10748
+ The index or the name of the axis. 0 is equivalent to None or 'index'.
10749
+ skipna : bool, default True
10750
+ Exclude NA/null values. If an entire row/column is NA, the result
10751
+ will be NA.
10752
+ *args, **kwargs
10753
+ Additional keywords have no effect but might be accepted for
10754
+ compatibility with NumPy.
10755
+ Returns
10756
+ -------
10757
+ %(name1)s or %(name2)s
10758
+ Return cumulative %(desc)s of %(name1)s or %(name2)s.
10759
+ See Also
10760
+ --------
10761
+ core.window.Expanding.%(accum_func_name)s : Similar functionality
10762
+ but ignores ``NaN`` values.
10763
+ %(name2)s.%(accum_func_name)s : Return the %(desc)s over
10764
+ %(name2)s axis.
10765
+ %(name2)s.cummax : Return cumulative maximum over %(name2)s axis.
10766
+ %(name2)s.cummin : Return cumulative minimum over %(name2)s axis.
10767
+ %(name2)s.cumsum : Return cumulative sum over %(name2)s axis.
10768
+ %(name2)s.cumprod : Return cumulative product over %(name2)s axis.
10769
+ %(examples)s"""
10770
+
10687
10771
_cummin_examples = """\
10688
10772
Examples
10689
10773
--------
@@ -11252,32 +11336,11 @@ def stat_func(
11252
11336
def _make_stat_function_ddof (
11253
11337
cls , name : str , name1 : str , name2 : str , axis_descr : str , desc : str , func : Callable
11254
11338
) -> Callable :
11255
- @doc (desc = desc , name1 = name1 , name2 = name2 , axis_descr = axis_descr )
11339
+ @Substitution (desc = desc , name1 = name1 , name2 = name2 , axis_descr = axis_descr )
11340
+ @Appender (_num_ddof_doc )
11256
11341
def stat_func (
11257
11342
self , axis = None , skipna = None , level = None , ddof = 1 , numeric_only = None , ** kwargs
11258
11343
):
11259
- """
11260
- {desc}
11261
-
11262
- Parameters
11263
- ----------
11264
- axis : {axis_descr}
11265
- skipna : bool, default True
11266
- Exclude NA/null values. If an entire row/column is NA, the result
11267
- will be NA.
11268
- level : int or level name, default None
11269
- If the axis is a MultiIndex (hierarchical), count along a
11270
- particular level, collapsing into a %(name1)s.
11271
- ddof : int, default 1
11272
- Delta Degrees of Freedom. The divisor used in calculations is N - ddof,
11273
- where N represents the number of elements.
11274
- numeric_only : bool, default None
11275
- Include only float, int, boolean columns. If None, will attempt to use
11276
- everything, then use only numeric data. Not implemented for Series.
11277
-
11278
- Returns
11279
- -------
11280
- {name1} or {name2} (if level specified)\n """
11281
11344
nv .validate_stat_ddof_func (tuple (), kwargs , fname = name )
11282
11345
if skipna is None :
11283
11346
skipna = True
@@ -11305,48 +11368,16 @@ def _make_cum_function(
11305
11368
accum_func_name : str ,
11306
11369
examples : str ,
11307
11370
) -> Callable :
11308
- @doc (
11371
+ @Substitution (
11309
11372
desc = desc ,
11310
11373
name1 = name1 ,
11311
11374
name2 = name2 ,
11375
+ axis_descr = axis_descr ,
11312
11376
accum_func_name = accum_func_name ,
11313
11377
examples = examples ,
11314
11378
)
11379
+ @Appender (_cnum_doc )
11315
11380
def cum_func (self , axis = None , skipna = True , * args , ** kwargs ):
11316
- """
11317
- Return cumulative {desc} over a DataFrame or Series axis.
11318
-
11319
- Returns a DataFrame or Series of the same size containing the cumulative
11320
- {desc}.
11321
-
11322
- Parameters
11323
- ----------
11324
- axis : {{0 or 'index', 1 or 'columns'}}, default 0
11325
- The index or the name of the axis. 0 is equivalent to None or 'index'.
11326
- skipna : bool, default True
11327
- Exclude NA/null values. If an entire row/column is NA, the result
11328
- will be NA.
11329
- *args, **kwargs
11330
- Additional keywords have no effect but might be accepted for
11331
- compatibility with NumPy.
11332
-
11333
- Returns
11334
- -------
11335
- {name1} or {name2}
11336
- Return cumulative {desc} of {name1} or {name2}.
11337
-
11338
- See Also
11339
- --------
11340
- core.window.Expanding.{accum_func_name} : Similar functionality
11341
- but ignores ``NaN`` values.
11342
- {name2}.{accum_func_name} : Return the {desc} over
11343
- {name2} axis.
11344
- {name2}.cummax : Return cumulative maximum over {name2} axis.
11345
- {name2}.cummin : Return cumulative minimum over {name2} axis.
11346
- {name2}.cumsum : Return cumulative sum over {name2} axis.
11347
- {name2}.cumprod : Return cumulative product over {name2} axis.
11348
-
11349
- {examples}"""
11350
11381
skipna = nv .validate_cum_func_with_skipna (skipna , args , kwargs , name )
11351
11382
if axis is None :
11352
11383
axis = self ._stat_axis_number
@@ -11383,52 +11414,17 @@ def _make_logical_function(
11383
11414
examples : str ,
11384
11415
empty_value : bool ,
11385
11416
) -> Callable :
11386
- @doc (
11417
+ @Substitution (
11387
11418
desc = desc ,
11388
11419
name1 = name1 ,
11389
11420
name2 = name2 ,
11421
+ axis_descr = axis_descr ,
11390
11422
see_also = see_also ,
11391
11423
examples = examples ,
11392
- empty_value = str ( empty_value ) ,
11424
+ empty_value = empty_value ,
11393
11425
)
11426
+ @Appender (_bool_doc )
11394
11427
def logical_func (self , axis = 0 , bool_only = None , skipna = True , level = None , ** kwargs ):
11395
- """
11396
- {desc}
11397
-
11398
- Parameters
11399
- ----------
11400
- axis : {{0 or 'index', 1 or 'columns', None}}, default 0
11401
- Indicate which axis or axes should be reduced.
11402
-
11403
- * 0 / 'index' : reduce the index, return a Series whose index is the
11404
- original column labels.
11405
- * 1 / 'columns' : reduce the columns, return a Series whose index is the
11406
- original index.
11407
- * None : reduce all axes, return a scalar.
11408
-
11409
- bool_only : bool, default None
11410
- Include only boolean columns. If None, will attempt to use everything,
11411
- then use only boolean data. Not implemented for Series.
11412
- skipna : bool, default True
11413
- Exclude NA/null values. If the entire row/column is NA and skipna is
11414
- True, then the result will be {empty_value}, as for an empty row/column.
11415
- If skipna is False, then NA are treated as True, because these are not
11416
- equal to zero.
11417
- level : int or level name, default None
11418
- If the axis is a MultiIndex (hierarchical), count along a
11419
- particular level, collapsing into a {name1}.
11420
- **kwargs : any, default None
11421
- Additional keywords have no effect but might be accepted for
11422
- compatibility with NumPy.
11423
-
11424
- Returns
11425
- -------
11426
- {name1} or {name2}
11427
- If level is specified, then, {name2} is returned; otherwise, {name1}
11428
- is returned.
11429
-
11430
- {see_also}
11431
- {examples}"""
11432
11428
nv .validate_logical_func (tuple (), kwargs , fname = name )
11433
11429
if level is not None :
11434
11430
if bool_only is not None :
0 commit comments