Skip to main content

load_polars_v44_52

Macro load_polars_v44_52 

Source
macro_rules! load_polars_v44_52 {
    ($df:expr) => { ... };
}
Expand description

Converts a Polars [DataFrame] into a Charton [Dataset] for Polars v0.44-v0.52.

This macro is specifically designed for older Polars versions (0.44-0.52) where the API differs from v0.53+. It uses get_columns() instead of columns() but both return &[Column], requiring the same as_series() extraction pattern.

§Mapping Logic:

  • Continuous: Maps all Floating Point and Integer types (from Int8 to UInt64).
  • Discrete: Maps String, Boolean, and encoded Categorical/Enum types.
  • Temporal: Maps Date, Time, Duration, and Datetime. All temporal types are normalized to Charton’s internal standard:
    • Datetime: i64 nanoseconds since Unix Epoch.
    • Date: i32 days since Unix Epoch.
    • Time: i64 nanoseconds since midnight.
    • Duration: i64 nanoseconds.

§Errors

Returns [ChartonError::Data] if a column contains a Polars type not yet supported by Charton’s core vectors (e.g., List, Struct, or Binary).