pub struct StrMatrix { /* private fields */ }Expand description
Row-major matrix of strings used by the categorical encoders.
Implementations§
Source§impl StrMatrix
impl StrMatrix
Sourcepub fn new(data: Vec<Vec<String>>) -> Result<Self>
pub fn new(data: Vec<Vec<String>>) -> Result<Self>
Creates a string matrix from a nested vector, validating a rectangular shape.
Sourcepub fn from_column<I, S>(col: I) -> Result<Self>
pub fn from_column<I, S>(col: I) -> Result<Self>
Creates a single-column string matrix from an iterator of values.
Sourcepub fn from_strings<I, S>(rows: I) -> Result<Self>
pub fn from_strings<I, S>(rows: I) -> Result<Self>
Creates a string matrix from an iterator of rows.
Sourcepub fn get(&self, i: usize, j: usize) -> &str
pub fn get(&self, i: usize, j: usize) -> &str
Returns the string at row i, column j.
§Panics
Panics if i >= nrows() or j >= ncols(). Use
checked_get for a safe alternative.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for StrMatrix
Available on crate feature serde only.
impl<'de> Deserialize<'de> for StrMatrix
Available on crate feature
serde only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for StrMatrix
Auto Trait Implementations§
impl Freeze for StrMatrix
impl RefUnwindSafe for StrMatrix
impl Send for StrMatrix
impl Sync for StrMatrix
impl Unpin for StrMatrix
impl UnsafeUnpin for StrMatrix
impl UnwindSafe for StrMatrix
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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