databricks.koalas.Series.prod

Series.prod(min_count=0) → Union[int, float]

Return the product of the values.

Note

unlike pandas’, Koalas’ emulates product by exp(sum(log(...))) trick. Therefore, it only works for positive numbers.

Parameters
min_countint, default 0

The required number of valid values to perform the operation. If fewer than min_count non-NA values are present the result will be NA.

Examples

>>> ks.Series([1, 2, 3, 4, 5]).prod()
120

By default, the product of an empty or all-NA Series is 1

>>> ks.Series([]).prod()
1.0

This can be controlled with the min_count parameter

>>> ks.Series([]).prod(min_count=1)
nan