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>>,
)
| 618 | /// - Creating lookup tables for identifiers |
| 619 | /// - Preparing categorical results for storage |
| 620 | pub 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 | /// |