Struct stats::Frequencies
source · pub struct Frequencies<T> { /* private fields */ }
Expand description
A commutative data structure for exact frequency counts.
Implementations§
source§impl<T: Eq + Hash> Frequencies<T>
impl<T: Eq + Hash> Frequencies<T>
sourcepub fn new() -> Frequencies<T>
pub fn new() -> Frequencies<T>
Create a new frequency table with no samples.
sourcepub fn cardinality(&self) -> u64
pub fn cardinality(&self) -> u64
Return the cardinality (number of unique elements) in the data.
sourcepub fn most_frequent(&self) -> (Vec<(&T, u64)>, u64)
pub fn most_frequent(&self) -> (Vec<(&T, u64)>, u64)
Return a Vec
of elements, their corresponding counts in
descending order, and the total count.
sourcepub fn least_frequent(&self) -> (Vec<(&T, u64)>, u64)
pub fn least_frequent(&self) -> (Vec<(&T, u64)>, u64)
Return a Vec
of elements, their corresponding counts in
ascending order, and the total count.
sourcepub fn par_frequent(&self, least: bool) -> (Vec<(&T, u64)>, u64)
pub fn par_frequent(&self, least: bool) -> (Vec<(&T, u64)>, u64)
Return a Vec
of elements, their corresponding counts in order
based on the least
parameter, and the total count. Uses parallel sort.
sourcepub fn unique_values(&self) -> UniqueValues<'_, T> ⓘ
pub fn unique_values(&self) -> UniqueValues<'_, T> ⓘ
Return an iterator over the unique values of the data.
Trait Implementations§
source§impl<T: Clone> Clone for Frequencies<T>
impl<T: Clone> Clone for Frequencies<T>
source§fn clone(&self) -> Frequencies<T>
fn clone(&self) -> Frequencies<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T: Eq + Hash> Default for Frequencies<T>
impl<T: Eq + Hash> Default for Frequencies<T>
source§fn default() -> Frequencies<T>
fn default() -> Frequencies<T>
Returns the “default value” for a type. Read more
source§impl<T: Eq + Hash> Extend<T> for Frequencies<T>
impl<T: Eq + Hash> Extend<T> for Frequencies<T>
source§fn extend<I: IntoIterator<Item = T>>(&mut self, it: I)
fn extend<I: IntoIterator<Item = T>>(&mut self, it: I)
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
source§impl<T: Eq + Hash> FromIterator<T> for Frequencies<T>
impl<T: Eq + Hash> FromIterator<T> for Frequencies<T>
source§fn from_iter<I: IntoIterator<Item = T>>(it: I) -> Frequencies<T>
fn from_iter<I: IntoIterator<Item = T>>(it: I) -> Frequencies<T>
Creates a value from an iterator. Read more
Auto Trait Implementations§
impl<T> Freeze for Frequencies<T>
impl<T> RefUnwindSafe for Frequencies<T>where
T: RefUnwindSafe,
impl<T> Send for Frequencies<T>where
T: Send,
impl<T> Sync for Frequencies<T>where
T: Sync,
impl<T> Unpin for Frequencies<T>where
T: Unpin,
impl<T> UnwindSafe for Frequencies<T>where
T: UnwindSafe,
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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