Closed wlwatkins closed 1 year ago
Can you run the example in this repo?
Hi! I have almost the same issue when trying to run the example:
> maturin develop -m extend_polars/Cargo.toml
` ... Compiling polars-ops v0.27.2
Compiling polars-time v0.27.2
Compiling polars-io v0.27.2
Compiling polars-plan v0.27.2
Compiling polars-pipe v0.27.2
Compiling polars-lazy v0.27.2
Compiling extend_polars v0.1.0 (/my_local_path_to_polars/extend_polars)
error[E0277]: the trait bound polars_core::frame::DataFrame: From<PyDataFrame> is not satisfied
--> src/lib.rs:13:25 |
13 | let df: DataFrame = pydf.into(); | ^^^^ ---- required by a bound introduced by this call |
---|---|---|---|
the trait From<PyDataFrame> is not implemented for polars_core::frame::DataFrame |
|||
= help: the trait From<&polars_core::prelude::Schema>
is implemented for polars_core::frame::DataFrame
= note: required for PyDataFrame
to implement Into<polars_core::frame::DataFrame>
error[E0277]: the trait bound PyPolarsErr: From<PolarsError> is not satisfied
--> src/lib.rs:14:14 |
14 | let df = parallel_jaccard_mod::parallel_jaccard(df, col_a, col_b).map_err(PyPolarsErr::from)?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait From<PolarsError> is not implemented for PyPolarsErr |
---|
= help: the following other types implement trait From<T>
:
<PyPolarsErr as From
error[E0277]: the trait bound PyPolarsErr: From<PolarsError> is not satisfied
--> src/lib.rs:14:79 |
14 | let df = parallel_jaccard_mod::parallel_jaccard(df, col_a, col_b).map_err(PyPolarsErr::from)?; | ^^^^^^^^^^^^^^^^^ the trait From<PolarsError> is not implemented for PyPolarsErr |
---|
= help: the following other types implement trait From<T>
:
<PyPolarsErr as From
error[E0308]: mismatched types
--> src/lib.rs:15:20 | 15 | Ok(PyDataFrame(df)) | ----------- ^^ expected struct polars_core::frame::DataFrame , found a different struct polars_core::frame::DataFrame |
---|---|---|---|
arguments to this struct are incorrect | |||
= note: struct `polars_core::frame::DataFrame` and struct `polars_core::frame::DataFrame` have similar names, but are actually distinct types
note: struct polars_core::frame::DataFrame
is defined in crate polars_core
`
I'm starting with rust and polars, so the problem may be between my screen and my chair :) Any help would be appreciated! Laurent
This is fixed. You must ensure you use the same rust polars
version as this crate does.
It works for me now, thanks @ritchie46 ! 👍
Unfortunately, I moved to ndarray after all. However I think there's an underlying issue with rust since some libraries seem to crash if they import different versions of the same library.
For instance I tried nsharr to convert between ndarray and nalgebra. But it used an older version of the latter and thus couldn't compile.
It would be nice that rust either warns or even gives solutions to working with various libraries like this. It might be a solved problem (thinking of pip) though.
Trying to select a column based on regex as in the example of polars.
but I seem to not be able to convert the PyDataFrame to a Dataframe, or lazyframe
Not sure if I'm doing it wrong, or if the library is not complet.
Error on
pydf.into();
I tried without the clone and lazy, but it still the same issue
maybe it's simply a regex issue....