MCPcopy Index your code
hub / github.com/SingleRust/SingleRust / create_string_dataframe_from_map

Function create_string_dataframe_from_map

src/memory/utils/mod.rs:620–632  ·  view source on GitHub ↗

Create a Polars DataFrame from a HashMap of String vectors. Specialized version of DataFrame creation for string data, commonly used for gene names, cell identifiers, and categorical analysis results. ## Parameters `map` - HashMap where keys are column names and values are String vectors ## Returns Polars DataFrame with string columns ## Usage Examples ```rust,ignore let mut gene_results = Has

(
    map: &HashMap<String, Vec<String>>,
)

Source from the content-addressed store, hash-verified

618/// - Creating lookup tables for identifiers
619/// - Preparing categorical results for storage
620pub fn create_string_dataframe_from_map(
621 map: &HashMap<String, Vec<String>>,
622) -> anyhow::Result<DataFrame> {
623 let mut df = DataFrame::default();
624
625 for (group, values) in map {
626 let string_slice: Vec<&str> = values.iter().map(|s| s.as_str()).collect();
627 let series = Series::new(group.into(), &string_slice);
628 df.with_column(series)?;
629 }
630
631 Ok(df)
632}
633
634/// Convert a 2D array between numeric types.
635///

Callers 1

store_resultsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected