pandas.core.resample.Resampler.prod#

final Resampler.prod(numeric_only=False, min_count=0, *args, **kwargs)[源代码]#

计算组值的乘积。

Parameters:
numeric_onlybool,默认 False

仅包括浮点数、整数、布尔列。

在 2.0.0 版本发生变更: numeric_only 不再接受 None

min_countint,默认为 0

执行操作所需的有效值数量。如果存在少于 min_count 个非NA值,则结果为NA。

Returns:
Series 或 DataFrame

计算每个组内值的乘积。

Examples

>>> ser = pd.Series([1, 2, 3, 4], index=pd.DatetimeIndex(
...                 ['2023-01-01', '2023-01-15', '2023-02-01', '2023-02-15']))
>>> ser
2023-01-01    1
2023-01-15    2
2023-02-01    3
2023-02-15    4
dtype: int64
>>> ser.resample('MS').prod()
2023-01-01    2
2023-02-01   12
Freq: MS, dtype: int64