phrs 0.4.1

A tabular data shell tool compatible with ph
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::error::PhError;
use polars::prelude::DataFrame;

pub fn require(df: &DataFrame, column: &str) -> Result<(), PhError> {
    if df
        .get_column_names()
        .iter()
        .any(|name| name.as_str() == column)
    {
        Ok(())
    } else {
        Err(PhError::new(format!("Unknown column {column}.")))
    }
}