pub enum Reducer {
}Expand description
A built-in reducer.
Variants§
Count
Number of present (non-missing) values.
Sum
Sum of present values; 0 when there are none.
Avg
Mean of present values; missing when there are none. "mean" parses
to this too.
Min
Smallest present value.
Max
Largest present value.
First
First present value.
Last
Last present value.
Median
50th percentile, interpolated.
Stdev
Population standard deviation (divides by n).
Percentile(f64)
Percentile q in [0, 100], linear interpolation between ranks
("p95").
Difference
Largest present value minus smallest (the spread); missing when
there are none. Number and decimal columns only. In rolling it
can be -0 (see crate::TimeSeries::rolling).
Keep
The value when every present value is equal, otherwise missing
(also missing when there are none). Any column kind; the output
has the source’s kind. Numbers compare as JavaScript’s === does,
so 0 equals -0: aggregate and reduce give the first one,
rolling gives 0. Array cells compare by their elements bit for
bit (so [0] and [-0] differ), where pond-ts compares the array
objects (so two equal arrays in different rows are kept here and
give a gap in pond-ts).
Unique
The distinct present values as a list (an array column), sorted:
numbers, then text, then true/false; text in JavaScript’s order (by
UTF-16 code units). An array column’s lists are flattened one level
first. 0 and -0 are one value, written 0. Nothing present
gives an empty list, not a gap. Any column kind; decimals are read
as their nearest f64.
Top(usize)
The N most frequent present values ("top3") as a list, most
frequent first, ties in Reducer::Unique’s order; flattening,
zeros and empty lists as there. N is at least 1.
Samples
Every present value as a list in arrival order, duplicates and -0
kept; flattening and empty lists as Reducer::Unique.
Implementations§
Trait Implementations§
impl Copy for Reducer
impl StructuralPartialEq for Reducer
Auto Trait Implementations§
impl Freeze for Reducer
impl RefUnwindSafe for Reducer
impl Send for Reducer
impl Sync for Reducer
impl Unpin for Reducer
impl UnsafeUnpin for Reducer
impl UnwindSafe for Reducer
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more