@@ -10365,6 +10365,60 @@ def _doc_parms(cls):
10365
10365
%(examples)s
10366
10366
"""
10367
10367
10368
+ _num_ddof_doc = """
10369
+ %(desc)s
10370
+ Parameters
10371
+ ----------
10372
+ axis : %(axis_descr)s
10373
+ skipna : bool, default True
10374
+ Exclude NA/null values. If an entire row/column is NA, the result
10375
+ will be NA.
10376
+ level : int or level name, default None
10377
+ If the axis is a MultiIndex (hierarchical), count along a
10378
+ particular level, collapsing into a %(name1)s.
10379
+ ddof : int, default 1
10380
+ Delta Degrees of Freedom. The divisor used in calculations is N - ddof,
10381
+ where N represents the number of elements.
10382
+ numeric_only : bool, default None
10383
+ Include only float, int, boolean columns. If None, will attempt to use
10384
+ everything, then use only numeric data. Not implemented for Series.
10385
+ Returns
10386
+ -------
10387
+ %(name1)s or %(name2)s (if level specified)\n """
10388
+
10389
+ _bool_doc = """
10390
+ %(desc)s
10391
+ Parameters
10392
+ ----------
10393
+ axis : {0 or 'index', 1 or 'columns', None}, default 0
10394
+ Indicate which axis or axes should be reduced.
10395
+ * 0 / 'index' : reduce the index, return a Series whose index is the
10396
+ original column labels.
10397
+ * 1 / 'columns' : reduce the columns, return a Series whose index is the
10398
+ original index.
10399
+ * None : reduce all axes, return a scalar.
10400
+ bool_only : bool, default None
10401
+ Include only boolean columns. If None, will attempt to use everything,
10402
+ then use only boolean data. Not implemented for Series.
10403
+ skipna : bool, default True
10404
+ Exclude NA/null values. If the entire row/column is NA and skipna is
10405
+ True, then the result will be %(empty_value)s, as for an empty row/column.
10406
+ If skipna is False, then NA are treated as True, because these are not
10407
+ equal to zero.
10408
+ level : int or level name, default None
10409
+ If the axis is a MultiIndex (hierarchical), count along a
10410
+ particular level, collapsing into a %(name1)s.
10411
+ **kwargs : any, default None
10412
+ Additional keywords have no effect but might be accepted for
10413
+ compatibility with NumPy.
10414
+ Returns
10415
+ -------
10416
+ %(name1)s or %(name2)s
10417
+ If level is specified, then, %(name2)s is returned; otherwise, %(name1)s
10418
+ is returned.
10419
+ %(see_also)s
10420
+ %(examples)s"""
10421
+
10368
10422
_all_desc = """\
10369
10423
Return whether all elements are True, potentially over an axis.
10370
10424
@@ -10425,6 +10479,36 @@ def _doc_parms(cls):
10425
10479
DataFrame.any : Return True if one (or more) elements are True.
10426
10480
"""
10427
10481
10482
+ _cnum_doc = """
10483
+ Return cumulative %(desc)s over a DataFrame or Series axis.
10484
+ Returns a DataFrame or Series of the same size containing the cumulative
10485
+ %(desc)s.
10486
+ Parameters
10487
+ ----------
10488
+ axis : {0 or 'index', 1 or 'columns'}, default 0
10489
+ The index or the name of the axis. 0 is equivalent to None or 'index'.
10490
+ skipna : bool, default True
10491
+ Exclude NA/null values. If an entire row/column is NA, the result
10492
+ will be NA.
10493
+ *args, **kwargs
10494
+ Additional keywords have no effect but might be accepted for
10495
+ compatibility with NumPy.
10496
+ Returns
10497
+ -------
10498
+ %(name1)s or %(name2)s
10499
+ Return cumulative %(desc)s of %(name1)s or %(name2)s.
10500
+ See Also
10501
+ --------
10502
+ core.window.Expanding.%(accum_func_name)s : Similar functionality
10503
+ but ignores ``NaN`` values.
10504
+ %(name2)s.%(accum_func_name)s : Return the %(desc)s over
10505
+ %(name2)s axis.
10506
+ %(name2)s.cummax : Return cumulative maximum over %(name2)s axis.
10507
+ %(name2)s.cummin : Return cumulative minimum over %(name2)s axis.
10508
+ %(name2)s.cumsum : Return cumulative sum over %(name2)s axis.
10509
+ %(name2)s.cumprod : Return cumulative product over %(name2)s axis.
10510
+ %(examples)s"""
10511
+
10428
10512
_cummin_examples = """\
10429
10513
Examples
10430
10514
--------
@@ -10993,32 +11077,11 @@ def stat_func(
10993
11077
def _make_stat_function_ddof (
10994
11078
cls , name : str , name1 : str , name2 : str , axis_descr : str , desc : str , func : Callable
10995
11079
) -> Callable :
10996
- @doc (desc = desc , name1 = name1 , name2 = name2 , axis_descr = axis_descr )
11080
+ @Substitution (desc = desc , name1 = name1 , name2 = name2 , axis_descr = axis_descr )
11081
+ @Appender (_num_ddof_doc )
10997
11082
def stat_func (
10998
11083
self , axis = None , skipna = None , level = None , ddof = 1 , numeric_only = None , ** kwargs
10999
11084
):
11000
- """
11001
- {desc}
11002
-
11003
- Parameters
11004
- ----------
11005
- axis : {axis_descr}
11006
- skipna : bool, default True
11007
- Exclude NA/null values. If an entire row/column is NA, the result
11008
- will be NA.
11009
- level : int or level name, default None
11010
- If the axis is a MultiIndex (hierarchical), count along a
11011
- particular level, collapsing into a %(name1)s.
11012
- ddof : int, default 1
11013
- Delta Degrees of Freedom. The divisor used in calculations is N - ddof,
11014
- where N represents the number of elements.
11015
- numeric_only : bool, default None
11016
- Include only float, int, boolean columns. If None, will attempt to use
11017
- everything, then use only numeric data. Not implemented for Series.
11018
-
11019
- Returns
11020
- -------
11021
- {name1} or {name2} (if level specified)\n """
11022
11085
nv .validate_stat_ddof_func (tuple (), kwargs , fname = name )
11023
11086
if skipna is None :
11024
11087
skipna = True
@@ -11046,48 +11109,16 @@ def _make_cum_function(
11046
11109
accum_func_name : str ,
11047
11110
examples : str ,
11048
11111
) -> Callable :
11049
- @doc (
11112
+ @Substitution (
11050
11113
desc = desc ,
11051
11114
name1 = name1 ,
11052
11115
name2 = name2 ,
11116
+ axis_descr = axis_descr ,
11053
11117
accum_func_name = accum_func_name ,
11054
11118
examples = examples ,
11055
11119
)
11120
+ @Appender (_cnum_doc )
11056
11121
def cum_func (self , axis = None , skipna = True , * args , ** kwargs ):
11057
- """
11058
- Return cumulative {desc} over a DataFrame or Series axis.
11059
-
11060
- Returns a DataFrame or Series of the same size containing the cumulative
11061
- {desc}.
11062
-
11063
- Parameters
11064
- ----------
11065
- axis : {{0 or 'index', 1 or 'columns'}}, default 0
11066
- The index or the name of the axis. 0 is equivalent to None or 'index'.
11067
- skipna : bool, default True
11068
- Exclude NA/null values. If an entire row/column is NA, the result
11069
- will be NA.
11070
- *args, **kwargs
11071
- Additional keywords have no effect but might be accepted for
11072
- compatibility with NumPy.
11073
-
11074
- Returns
11075
- -------
11076
- {name1} or {name2}
11077
- Return cumulative {desc} of {name1} or {name2}.
11078
-
11079
- See Also
11080
- --------
11081
- core.window.Expanding.{accum_func_name} : Similar functionality
11082
- but ignores ``NaN`` values.
11083
- {name2}.{accum_func_name} : Return the {desc} over
11084
- {name2} axis.
11085
- {name2}.cummax : Return cumulative maximum over {name2} axis.
11086
- {name2}.cummin : Return cumulative minimum over {name2} axis.
11087
- {name2}.cumsum : Return cumulative sum over {name2} axis.
11088
- {name2}.cumprod : Return cumulative product over {name2} axis.
11089
-
11090
- {examples}"""
11091
11122
skipna = nv .validate_cum_func_with_skipna (skipna , args , kwargs , name )
11092
11123
if axis is None :
11093
11124
axis = self ._stat_axis_number
@@ -11126,52 +11157,17 @@ def _make_logical_function(
11126
11157
examples : str ,
11127
11158
empty_value : bool ,
11128
11159
) -> Callable :
11129
- @doc (
11160
+ @Substitution (
11130
11161
desc = desc ,
11131
11162
name1 = name1 ,
11132
11163
name2 = name2 ,
11164
+ axis_descr = axis_descr ,
11133
11165
see_also = see_also ,
11134
11166
examples = examples ,
11135
- empty_value = str ( empty_value ) ,
11167
+ empty_value = empty_value ,
11136
11168
)
11169
+ @Appender (_bool_doc )
11137
11170
def logical_func (self , axis = 0 , bool_only = None , skipna = True , level = None , ** kwargs ):
11138
- """
11139
- {desc}
11140
-
11141
- Parameters
11142
- ----------
11143
- axis : {{0 or 'index', 1 or 'columns', None}}, default 0
11144
- Indicate which axis or axes should be reduced.
11145
-
11146
- * 0 / 'index' : reduce the index, return a Series whose index is the
11147
- original column labels.
11148
- * 1 / 'columns' : reduce the columns, return a Series whose index is the
11149
- original index.
11150
- * None : reduce all axes, return a scalar.
11151
-
11152
- bool_only : bool, default None
11153
- Include only boolean columns. If None, will attempt to use everything,
11154
- then use only boolean data. Not implemented for Series.
11155
- skipna : bool, default True
11156
- Exclude NA/null values. If the entire row/column is NA and skipna is
11157
- True, then the result will be {empty_value}, as for an empty row/column.
11158
- If skipna is False, then NA are treated as True, because these are not
11159
- equal to zero.
11160
- level : int or level name, default None
11161
- If the axis is a MultiIndex (hierarchical), count along a
11162
- particular level, collapsing into a {name1}.
11163
- **kwargs : any, default None
11164
- Additional keywords have no effect but might be accepted for
11165
- compatibility with NumPy.
11166
-
11167
- Returns
11168
- -------
11169
- {name1} or {name2}
11170
- If level is specified, then, {name2} is returned; otherwise, {name1}
11171
- is returned.
11172
-
11173
- {see_also}
11174
- {examples}"""
11175
11171
nv .validate_logical_func (tuple (), kwargs , fname = name )
11176
11172
if level is not None :
11177
11173
if bool_only is not None :
0 commit comments