[−][src]Struct stats::Frequencies
A commutative data structure for exact frequency counts.
Methods
impl<T: Eq + Hash> Frequencies<T>
[src]
pub fn new() -> Frequencies<T>
[src]
Create a new frequency table with no samples.
pub fn add(&mut self, v: T)
[src]
Add a sample to the frequency table.
pub fn count(&self, v: &T) -> u64
[src]
Return the number of occurrences of v
in the data.
pub fn cardinality(&self) -> u64
[src]
Return the cardinality (number of unique elements) in the data.
pub fn mode(&self) -> Option<&T>
[src]
Returns the mode if one exists.
pub fn most_frequent(&self) -> Vec<(&T, u64)>
[src]
Return a Vec
of elements and their corresponding counts in
descending order.
pub fn least_frequent(&self) -> Vec<(&T, u64)>
[src]
Return a Vec
of elements and their corresponding counts in
ascending order.
pub fn len(&self) -> usize
[src]
Returns the cardinality of the data.
Trait Implementations
impl<T: Clone> Clone for Frequencies<T>
[src]
fn clone(&self) -> Frequencies<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Eq + Hash> Commute for Frequencies<T>
[src]
fn merge(&mut self, v: Frequencies<T>)
[src]
fn consume<I: Iterator<Item = Self>>(&mut self, other: I)
[src]
impl<T: Debug + Eq + Hash> Debug for Frequencies<T>
[src]
impl<T: Eq + Hash> Default for Frequencies<T>
[src]
fn default() -> Frequencies<T>
[src]
impl<T: Eq + Hash> Extend<T> for Frequencies<T>
[src]
fn extend<I: IntoIterator<Item = T>>(&mut self, it: I)
[src]
impl<T: Eq + Hash> FromIterator<T> for Frequencies<T>
[src]
fn from_iter<I: IntoIterator<Item = T>>(it: I) -> Frequencies<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Frequencies<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Frequencies<T> where
T: Send,
T: Send,
impl<T> Sync for Frequencies<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Frequencies<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Frequencies<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,