pub struct FormatConverter;Expand description
Format conversion utilities
Implementations§
Source§impl FormatConverter
impl FormatConverter
Sourcepub fn csv_to_arrays<P: AsRef<Path>>(
path: P,
delimiter: char,
has_header: bool,
) -> UtilsResult<(Option<Vec<String>>, Array2<f64>)>
pub fn csv_to_arrays<P: AsRef<Path>>( path: P, delimiter: char, has_header: bool, ) -> UtilsResult<(Option<Vec<String>>, Array2<f64>)>
Convert CSV to structured data
Sourcepub fn arrays_to_csv<P: AsRef<Path>>(
path: P,
data: &Array2<f64>,
header: Option<&[String]>,
delimiter: char,
) -> UtilsResult<()>
pub fn arrays_to_csv<P: AsRef<Path>>( path: P, data: &Array2<f64>, header: Option<&[String]>, delimiter: char, ) -> UtilsResult<()>
Convert arrays to CSV format
Sourcepub fn json_to_map(json_str: &str) -> UtilsResult<HashMap<String, Value>>
pub fn json_to_map(json_str: &str) -> UtilsResult<HashMap<String, Value>>
Convert JSON-like key-value data
Sourcepub fn map_to_json(map: &HashMap<String, Value>) -> UtilsResult<String>
pub fn map_to_json(map: &HashMap<String, Value>) -> UtilsResult<String>
Convert map to JSON string
Sourcepub fn json_to_arrays(
json_str: &str,
) -> UtilsResult<HashMap<String, Array2<f64>>>
pub fn json_to_arrays( json_str: &str, ) -> UtilsResult<HashMap<String, Array2<f64>>>
Enhanced JSON utilities for ML data structures
Sourcepub fn arrays_to_json(
arrays: &HashMap<String, &Array2<f64>>,
) -> UtilsResult<String>
pub fn arrays_to_json( arrays: &HashMap<String, &Array2<f64>>, ) -> UtilsResult<String>
Convert arrays to JSON format for ML data
Auto Trait Implementations§
impl Freeze for FormatConverter
impl RefUnwindSafe for FormatConverter
impl Send for FormatConverter
impl Sync for FormatConverter
impl Unpin for FormatConverter
impl UnwindSafe for FormatConverter
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