DataFrame.
prod
Return the product of the values as Series.
Note
unlike pandas’, Koalas’ emulates product by exp(sum(log(...))) trick. Therefore, it only works for positive numbers.
exp(sum(log(...)))
Examples
Non-numeric type column is not included to the result.
>>> kdf = ks.DataFrame({'A': [1, 2, 3, 4, 5], ... 'B': [10, 20, 30, 40, 50], ... 'C': ['a', 'b', 'c', 'd', 'e']}) >>> kdf A B C 0 1 10 a 1 2 20 b 2 3 30 c 3 4 40 d 4 5 50 e
>>> kdf.prod().sort_index() A 120 B 12000000 dtype: int64
If there is no numeric type columns, returns empty Series.
>>> ks.DataFrame({"key": ['a', 'b', 'c'], "val": ['x', 'y', 'z']}).prod() Series([], dtype: float64)