pub struct Counter { /* private fields */ }Expand description
Hash-based counter: accumulates (key_tuple → count) without building
an intermediate DataFrame. Purpose-built for FAERS drug×event counting.
Implementations§
Source§impl Counter
impl Counter
Sourcepub fn increment_by(&mut self, key: Vec<String>, n: u64)
pub fn increment_by(&mut self, key: Vec<String>, n: u64)
Increment by a specific amount.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&Vec<String>, &u64)>
pub fn iter(&self) -> impl Iterator<Item = (&Vec<String>, &u64)>
Iterate over all (key, count) pairs.
Sourcepub fn into_dataframe(self) -> Result<DataFrame, DataFrameError>
pub fn into_dataframe(self) -> Result<DataFrame, DataFrameError>
Convert the counter into a DataFrame with key columns + a “count” column.
Each unique key combination becomes a row. The last column is always “count”.
Sourcepub fn from_dataframe(
df: &DataFrame,
group_cols: &[&str],
) -> Result<Self, DataFrameError>
pub fn from_dataframe( df: &DataFrame, group_cols: &[&str], ) -> Result<Self, DataFrameError>
Build a counter from a DataFrame by counting rows grouped by specified columns.
Sourcepub fn filter_min_count(&self, min_count: u64) -> Self
pub fn filter_min_count(&self, min_count: u64) -> Self
Filter the counter, keeping only entries where count >= min_count.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Counter
impl RefUnwindSafe for Counter
impl Send for Counter
impl Sync for Counter
impl Unpin for Counter
impl UnsafeUnpin for Counter
impl UnwindSafe for Counter
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