Closed MarcoGorelli closed 11 months ago
I'm trying to make sense of pyo3-polars in order to write a plugin
I've tried writing the simplest function:
#[polars_expr(output_type=Date)] fn add_bday(inputs: &[Series]) -> PolarsResult<Series> { let ca = inputs[0].date()?; Ok(ca.clone().into_series()) }
but I get
thread '<unnamed>' panicked at 'assertion failed: `(left == right)` left: `Date32`, right: `Int32`', /home/marcogorelli/.cargo/registry/src/index.crates.io-6f17d22bba15001f/polars-core-0.33.2/src/chunked_array/from.rs:166:17
Looking like
let inputs = polars_ffi::import_series_buffer(e, len).unwrap();
might be panicking?
Here's my complete repo, for a reproducible example: https://github.com/MarcoGorelli/my-wip-polars-extension
Current workaround: cast to the physical type when initialising the accessor:
https://github.com/MarcoGorelli/polars-business/blob/6a2e8dc0225ad916bc8c26dc34ae2cdca4420791/src/polars_business/polars_business/__init__.py#L12-L13
Fixed
I'm trying to make sense of pyo3-polars in order to write a plugin
I've tried writing the simplest function:
but I get
Looking like
might be panicking?
Here's my complete repo, for a reproducible example: https://github.com/MarcoGorelli/my-wip-polars-extension