@@ -10400,6 +10400,60 @@ def _doc_parms(cls):
10400
10400
%(examples)s
10401
10401
"""
10402
10402
10403
+ _num_ddof_doc = """
10404
+ %(desc)s
10405
+ Parameters
10406
+ ----------
10407
+ axis : %(axis_descr)s
10408
+ skipna : bool, default True
10409
+ Exclude NA/null values. If an entire row/column is NA, the result
10410
+ will be NA.
10411
+ level : int or level name, default None
10412
+ If the axis is a MultiIndex (hierarchical), count along a
10413
+ particular level, collapsing into a %(name1)s.
10414
+ ddof : int, default 1
10415
+ Delta Degrees of Freedom. The divisor used in calculations is N - ddof,
10416
+ where N represents the number of elements.
10417
+ numeric_only : bool, default None
10418
+ Include only float, int, boolean columns. If None, will attempt to use
10419
+ everything, then use only numeric data. Not implemented for Series.
10420
+ Returns
10421
+ -------
10422
+ %(name1)s or %(name2)s (if level specified)\n """
10423
+
10424
+ _bool_doc = """
10425
+ %(desc)s
10426
+ Parameters
10427
+ ----------
10428
+ axis : {0 or 'index', 1 or 'columns', None}, default 0
10429
+ Indicate which axis or axes should be reduced.
10430
+ * 0 / 'index' : reduce the index, return a Series whose index is the
10431
+ original column labels.
10432
+ * 1 / 'columns' : reduce the columns, return a Series whose index is the
10433
+ original index.
10434
+ * None : reduce all axes, return a scalar.
10435
+ bool_only : bool, default None
10436
+ Include only boolean columns. If None, will attempt to use everything,
10437
+ then use only boolean data. Not implemented for Series.
10438
+ skipna : bool, default True
10439
+ Exclude NA/null values. If the entire row/column is NA and skipna is
10440
+ True, then the result will be %(empty_value)s, as for an empty row/column.
10441
+ If skipna is False, then NA are treated as True, because these are not
10442
+ equal to zero.
10443
+ level : int or level name, default None
10444
+ If the axis is a MultiIndex (hierarchical), count along a
10445
+ particular level, collapsing into a %(name1)s.
10446
+ **kwargs : any, default None
10447
+ Additional keywords have no effect but might be accepted for
10448
+ compatibility with NumPy.
10449
+ Returns
10450
+ -------
10451
+ %(name1)s or %(name2)s
10452
+ If level is specified, then, %(name2)s is returned; otherwise, %(name1)s
10453
+ is returned.
10454
+ %(see_also)s
10455
+ %(examples)s"""
10456
+
10403
10457
_all_desc = """\
10404
10458
Return whether all elements are True, potentially over an axis.
10405
10459
@@ -10460,6 +10514,36 @@ def _doc_parms(cls):
10460
10514
DataFrame.any : Return True if one (or more) elements are True.
10461
10515
"""
10462
10516
10517
+ _cnum_doc = """
10518
+ Return cumulative %(desc)s over a DataFrame or Series axis.
10519
+ Returns a DataFrame or Series of the same size containing the cumulative
10520
+ %(desc)s.
10521
+ Parameters
10522
+ ----------
10523
+ axis : {0 or 'index', 1 or 'columns'}, default 0
10524
+ The index or the name of the axis. 0 is equivalent to None or 'index'.
10525
+ skipna : bool, default True
10526
+ Exclude NA/null values. If an entire row/column is NA, the result
10527
+ will be NA.
10528
+ *args, **kwargs
10529
+ Additional keywords have no effect but might be accepted for
10530
+ compatibility with NumPy.
10531
+ Returns
10532
+ -------
10533
+ %(name1)s or %(name2)s
10534
+ Return cumulative %(desc)s of %(name1)s or %(name2)s.
10535
+ See Also
10536
+ --------
10537
+ core.window.Expanding.%(accum_func_name)s : Similar functionality
10538
+ but ignores ``NaN`` values.
10539
+ %(name2)s.%(accum_func_name)s : Return the %(desc)s over
10540
+ %(name2)s axis.
10541
+ %(name2)s.cummax : Return cumulative maximum over %(name2)s axis.
10542
+ %(name2)s.cummin : Return cumulative minimum over %(name2)s axis.
10543
+ %(name2)s.cumsum : Return cumulative sum over %(name2)s axis.
10544
+ %(name2)s.cumprod : Return cumulative product over %(name2)s axis.
10545
+ %(examples)s"""
10546
+
10463
10547
_cummin_examples = """\
10464
10548
Examples
10465
10549
--------
@@ -11028,32 +11112,11 @@ def stat_func(
11028
11112
def _make_stat_function_ddof (
11029
11113
cls , name : str , name1 : str , name2 : str , axis_descr : str , desc : str , func : Callable
11030
11114
) -> Callable :
11031
- @doc (desc = desc , name1 = name1 , name2 = name2 , axis_descr = axis_descr )
11115
+ @Substitution (desc = desc , name1 = name1 , name2 = name2 , axis_descr = axis_descr )
11116
+ @Appender (_num_ddof_doc )
11032
11117
def stat_func (
11033
11118
self , axis = None , skipna = None , level = None , ddof = 1 , numeric_only = None , ** kwargs
11034
11119
):
11035
- """
11036
- {desc}
11037
-
11038
- Parameters
11039
- ----------
11040
- axis : {axis_descr}
11041
- skipna : bool, default True
11042
- Exclude NA/null values. If an entire row/column is NA, the result
11043
- will be NA.
11044
- level : int or level name, default None
11045
- If the axis is a MultiIndex (hierarchical), count along a
11046
- particular level, collapsing into a %(name1)s.
11047
- ddof : int, default 1
11048
- Delta Degrees of Freedom. The divisor used in calculations is N - ddof,
11049
- where N represents the number of elements.
11050
- numeric_only : bool, default None
11051
- Include only float, int, boolean columns. If None, will attempt to use
11052
- everything, then use only numeric data. Not implemented for Series.
11053
-
11054
- Returns
11055
- -------
11056
- {name1} or {name2} (if level specified)\n """
11057
11120
nv .validate_stat_ddof_func (tuple (), kwargs , fname = name )
11058
11121
if skipna is None :
11059
11122
skipna = True
@@ -11081,48 +11144,16 @@ def _make_cum_function(
11081
11144
accum_func_name : str ,
11082
11145
examples : str ,
11083
11146
) -> Callable :
11084
- @doc (
11147
+ @Substitution (
11085
11148
desc = desc ,
11086
11149
name1 = name1 ,
11087
11150
name2 = name2 ,
11151
+ axis_descr = axis_descr ,
11088
11152
accum_func_name = accum_func_name ,
11089
11153
examples = examples ,
11090
11154
)
11155
+ @Appender (_cnum_doc )
11091
11156
def cum_func (self , axis = None , skipna = True , * args , ** kwargs ):
11092
- """
11093
- Return cumulative {desc} over a DataFrame or Series axis.
11094
-
11095
- Returns a DataFrame or Series of the same size containing the cumulative
11096
- {desc}.
11097
-
11098
- Parameters
11099
- ----------
11100
- axis : {{0 or 'index', 1 or 'columns'}}, default 0
11101
- The index or the name of the axis. 0 is equivalent to None or 'index'.
11102
- skipna : bool, default True
11103
- Exclude NA/null values. If an entire row/column is NA, the result
11104
- will be NA.
11105
- *args, **kwargs
11106
- Additional keywords have no effect but might be accepted for
11107
- compatibility with NumPy.
11108
-
11109
- Returns
11110
- -------
11111
- {name1} or {name2}
11112
- Return cumulative {desc} of {name1} or {name2}.
11113
-
11114
- See Also
11115
- --------
11116
- core.window.Expanding.{accum_func_name} : Similar functionality
11117
- but ignores ``NaN`` values.
11118
- {name2}.{accum_func_name} : Return the {desc} over
11119
- {name2} axis.
11120
- {name2}.cummax : Return cumulative maximum over {name2} axis.
11121
- {name2}.cummin : Return cumulative minimum over {name2} axis.
11122
- {name2}.cumsum : Return cumulative sum over {name2} axis.
11123
- {name2}.cumprod : Return cumulative product over {name2} axis.
11124
-
11125
- {examples}"""
11126
11157
skipna = nv .validate_cum_func_with_skipna (skipna , args , kwargs , name )
11127
11158
if axis is None :
11128
11159
axis = self ._stat_axis_number
@@ -11159,52 +11190,17 @@ def _make_logical_function(
11159
11190
examples : str ,
11160
11191
empty_value : bool ,
11161
11192
) -> Callable :
11162
- @doc (
11193
+ @Substitution (
11163
11194
desc = desc ,
11164
11195
name1 = name1 ,
11165
11196
name2 = name2 ,
11197
+ axis_descr = axis_descr ,
11166
11198
see_also = see_also ,
11167
11199
examples = examples ,
11168
- empty_value = str ( empty_value ) ,
11200
+ empty_value = empty_value ,
11169
11201
)
11202
+ @Appender (_bool_doc )
11170
11203
def logical_func (self , axis = 0 , bool_only = None , skipna = True , level = None , ** kwargs ):
11171
- """
11172
- {desc}
11173
-
11174
- Parameters
11175
- ----------
11176
- axis : {{0 or 'index', 1 or 'columns', None}}, default 0
11177
- Indicate which axis or axes should be reduced.
11178
-
11179
- * 0 / 'index' : reduce the index, return a Series whose index is the
11180
- original column labels.
11181
- * 1 / 'columns' : reduce the columns, return a Series whose index is the
11182
- original index.
11183
- * None : reduce all axes, return a scalar.
11184
-
11185
- bool_only : bool, default None
11186
- Include only boolean columns. If None, will attempt to use everything,
11187
- then use only boolean data. Not implemented for Series.
11188
- skipna : bool, default True
11189
- Exclude NA/null values. If the entire row/column is NA and skipna is
11190
- True, then the result will be {empty_value}, as for an empty row/column.
11191
- If skipna is False, then NA are treated as True, because these are not
11192
- equal to zero.
11193
- level : int or level name, default None
11194
- If the axis is a MultiIndex (hierarchical), count along a
11195
- particular level, collapsing into a {name1}.
11196
- **kwargs : any, default None
11197
- Additional keywords have no effect but might be accepted for
11198
- compatibility with NumPy.
11199
-
11200
- Returns
11201
- -------
11202
- {name1} or {name2}
11203
- If level is specified, then, {name2} is returned; otherwise, {name1}
11204
- is returned.
11205
-
11206
- {see_also}
11207
- {examples}"""
11208
11204
nv .validate_logical_func (tuple (), kwargs , fname = name )
11209
11205
if level is not None :
11210
11206
if bool_only is not None :
0 commit comments