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

Function create_dataframe_from_map

src/memory/utils/mod.rs:579–591  ·  view source on GitHub ↗

Create a Polars DataFrame from a HashMap of numeric vectors. Converts analysis results stored as HashMap > into a structured DataFrame format suitable for storage in AnnData objects or further analysis. Commonly used for differential expression results, QC metrics, and other group-wise analysis outputs. ## Parameters `map` - HashMap where keys are column names and values are data v

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

Source from the content-addressed store, hash-verified

577/// - Converting analysis outputs for AnnData storage
578/// - Preparing data for visualization or export
579pub fn create_dataframe_from_map<T>(map: &HashMap<String, Vec<T>>) -> anyhow::Result<DataFrame>
580where
581 T: Clone,
582 Series: NamedFromOwned<Vec<T>>,
583{
584 let mut df = DataFrame::default();
585
586 for (group, values) in map {
587 let ser = polars::prelude::Series::from_vec(group.into(), values.clone()).into_column();
588 df.with_column(ser)?;
589 }
590 Ok(df)
591}
592
593/// Create a Polars DataFrame from a HashMap of String vectors.
594///

Callers 1

store_resultsFunction · 0.85

Calls 1

cloneMethod · 0.80

Tested by

no test coverage detected