Reputation: 21
I have a Python function such as
def add_data(input_df): """ some manipulation of input_df (Polars dataframe) such as filling some columns with new values """
I would like to use this function from a Rust function. input_df can be tens of megabytes big, so I'd like to use zero-copy share between Python and Rust. Is there any example code on this available?
I found Is it possible to access underlying data from Polars in cython? but this seems to be Cython. I am looking for a pure Python way.
Upvotes: 2
Views: 966
Reputation: 14690
I made a crate for this to make this easy: https://github.com/pola-rs/pyo3-polars
See the examples to get started: https://github.com/pola-rs/pyo3-polars/tree/main/example
Upvotes: 1