Trait polars_core::prelude::ChunkAggSeries
source · pub trait ChunkAggSeries {
fn sum_as_series(&self) -> Series { ... }
fn max_as_series(&self) -> Series { ... }
fn min_as_series(&self) -> Series { ... }
fn prod_as_series(&self) -> Series { ... }
}Expand description
Aggregations that return Series of unit length. Those can be used in broadcasting operations.
Provided Methods§
sourcefn sum_as_series(&self) -> Series
fn sum_as_series(&self) -> Series
Get the sum of the ChunkedArray as a new Series of length 1.
Examples found in repository?
More examples
sourcefn max_as_series(&self) -> Series
fn max_as_series(&self) -> Series
Get the max of the ChunkedArray as a new Series of length 1.
Examples found in repository?
More examples
sourcefn min_as_series(&self) -> Series
fn min_as_series(&self) -> Series
Get the min of the ChunkedArray as a new Series of length 1.
Examples found in repository?
More examples
sourcefn prod_as_series(&self) -> Series
fn prod_as_series(&self) -> Series
Get the product of the ChunkedArray as a new Series of length 1.
Examples found in repository?
src/series/mod.rs (line 666)
654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683
pub fn product(&self) -> Series {
#[cfg(feature = "product")]
{
use DataType::*;
match self.dtype() {
Boolean => self.cast(&DataType::Int64).unwrap().product(),
Int8 | UInt8 | Int16 | UInt16 => {
let s = self.cast(&Int64).unwrap();
s.product()
}
Int64 => {
let ca = self.i64().unwrap();
ca.prod_as_series()
}
Float32 => {
let ca = self.f32().unwrap();
ca.prod_as_series()
}
Float64 => {
let ca = self.f64().unwrap();
ca.prod_as_series()
}
dt => panic!("cumprod not supported for dtype: {dt:?}"),
}
}
#[cfg(not(feature = "product"))]
{
panic!("activate 'product' feature")
}
}