@@ -164,32 +164,6 @@ class providing the base-class of operations.
164164 to each row or column of a DataFrame.
165165"""
166166
167- _groupby_agg_method_template = """
168- Compute {fname} of group values.
169-
170- Parameters
171- ----------
172- numeric_only : bool, default {no}
173- Include only float, int, boolean columns.
174-
175- .. versionchanged:: 2.0.0
176-
177- numeric_only no longer accepts ``None``.
178-
179- min_count : int, default {mc}
180- The required number of valid values to perform the operation. If fewer
181- than ``min_count`` non-NA values are present the result will be NA.
182-
183- Returns
184- -------
185- Series or DataFrame
186- Computed {fname} of values within each group.
187-
188- Examples
189- --------
190- {example}
191- """
192-
193167_groupby_agg_method_engine_template = """
194168Compute {fname} of group values.
195169
@@ -3029,16 +3003,38 @@ def sum(
30293003 return result
30303004
30313005 @final
3032- @doc (
3033- _groupby_agg_method_template ,
3034- fname = "prod" ,
3035- no = False ,
3036- mc = 0 ,
3037- example = dedent (
3038- """\
3006+ def prod (self , numeric_only : bool = False , min_count : int = 0 ) -> NDFrameT :
3007+ """
3008+ Compute prod of group values.
3009+
3010+ Parameters
3011+ ----------
3012+ numeric_only : bool, default False
3013+ Include only float, int, boolean columns.
3014+
3015+ .. versionchanged:: 2.0.0
3016+
3017+ numeric_only no longer accepts ``None``.
3018+
3019+ min_count : int, default 0
3020+ The required number of valid values to perform the operation. If fewer
3021+ than ``min_count`` non-NA values are present the result will be NA.
3022+
3023+ Returns
3024+ -------
3025+ Series or DataFrame
3026+ Computed prod of values within each group.
3027+
3028+ See Also
3029+ --------
3030+ Series.prod : Return the product of the values over the requested axis.
3031+ DataFrame.prod : Return the product of the values over the requested axis.
3032+
3033+ Examples
3034+ --------
30393035 For SeriesGroupBy:
30403036
3041- >>> lst = ['a', 'a', 'b', 'b' ]
3037+ >>> lst = ["a", "a", "b", "b" ]
30423038 >>> ser = pd.Series([1, 2, 3, 4], index=lst)
30433039 >>> ser
30443040 a 1
@@ -3054,8 +3050,11 @@ def sum(
30543050 For DataFrameGroupBy:
30553051
30563052 >>> data = [[1, 8, 2], [1, 2, 5], [2, 5, 8], [2, 6, 9]]
3057- >>> df = pd.DataFrame(data, columns=["a", "b", "c"],
3058- ... index=["tiger", "leopard", "cheetah", "lion"])
3053+ >>> df = pd.DataFrame(
3054+ ... data,
3055+ ... columns=["a", "b", "c"],
3056+ ... index=["tiger", "leopard", "cheetah", "lion"],
3057+ ... )
30593058 >>> df
30603059 a b c
30613060 tiger 1 8 2
@@ -3066,10 +3065,8 @@ def sum(
30663065 b c
30673066 a
30683067 1 16 10
3069- 2 30 72"""
3070- ),
3071- )
3072- def prod (self , numeric_only : bool = False , min_count : int = 0 ) -> NDFrameT :
3068+ 2 30 72
3069+ """
30733070 return self ._agg_general (
30743071 numeric_only = numeric_only , min_count = min_count , alias = "prod" , npfunc = np .prod
30753072 )
0 commit comments