pola-rs / pyo3-polars

Plugins/extension for Polars
MIT License
232 stars 38 forks source link

Namespace API for DataFrame/LazyFrame #60

Open abhiaagarwal opened 7 months ago

abhiaagarwal commented 7 months ago

Currently, Polars supports defining custom functions on the DataFrame namespace on the python side with pl.api.register_dataframe_namespace/pl.api.register_lazyframe_namespace. Would it be possible for pyo3-polars to support creating a custom DataFrame namespace with this same functionality, with the defined transformations living in rust?

For a somewhat abstract example, I have a function written in rust that takes a pl.DataFrame as an argument, loads a xgboost Booster, calculates a column, then returns the DataFrame. I want to expose this exact same functionality in Python by registering some custom namespace.