polars.Series.sum
-
Reduce this Series to the sum value.
Notes
- Dtypes in {Int8, UInt8, Int16, UInt16} are cast to Int64 before summing to prevent overflow issues.
- If there are no non-null values, then the output is
0. If you would prefer empty sums to returnNone, you can uses.sum() if s.count() else Noneinstead ofs.sum().
Examples
>>> s = pl.Series("a", [1, 2, 3]) >>> s.sum() 6
Series.sum() → int | float | Decimal
© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/series/api/polars.Series.sum.html