polars.Expr.product
-
Compute the product of an expression.
Notes
If there are no non-null values, then the output is
1. If you would prefer empty products to returnNone, you can usepl.when(expr.count()>0).then(expr.product())instead ofexpr.product().Examples
>>> df = pl.DataFrame({"a": [1, 2, 3]}) >>> df.select(pl.col("a").product()) shape: (1, 1) ┌─────┐ │ a │ │ --- │ │ i64 │ ╞═════╡ │ 6 │ └─────┘
Expr.product() → Expr
© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/expressions/api/polars.Expr.product.html