Open sdrap opened 1 year ago
It's not really a pyo3-polars
problem.
Everything is zero-copy indeed... until you start mutating things like you try to.
In general, you want to avoid doing a[0, 'A']
= 5 since it may result in copying the entire 'A' column.
// See PySeries::set_at_idx()
.
To have in/out-mutable array data on both Rust/Python sides, you can use numpy
wrappers if that fits the use case.
Thanks for the great work with polars as well as the pyo3 exposition of dataframe/series.
I have the following problem (disclaimer still a couple of hours away form
hello rust
).I want a rust
struct
containing several dataframes accessible in python with polars (and eventually zero copy to pandas with arrow).I don't quite understand how to pass a shared reference in that case.
Here is a minimal example.
Cargo.toml
src/lib.rs
compilation is ok, now in python
I thought that everything would be zero-copy or just passing of references so that any manipulation on the rust or python side would be on the same reference object.
I might be a bit naive (there is something about using some
Py<..>
for classes in pyo3 but I don't understand how it fits within pyo3-polars.Many thanks and sorry for a beginner kind of question.