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