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>>)
| 577 | /// - Converting analysis outputs for AnnData storage |
| 578 | /// - Preparing data for visualization or export |
| 579 | pub fn create_dataframe_from_map<T>(map: &HashMap<String, Vec<T>>) -> anyhow::Result<DataFrame> |
| 580 | where |
| 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 | /// |