Spec-Zone.ru › Polars

polars.Series.sum

Series.sum() → int | float | Decimal

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 return None, you can use s.sum() if s.count() else None instead of s.sum().

Examples

>>> s = pl.Series("a", [1, 2, 3])
>>> s.sum()
6

© 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

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API