[зависимости]
ordered-float: "4.4"
polars: {version="0.43", Features = ["lazy", "parquet", "dtype-struct", "dtype-u8", "round_series"]
itertools = "0.13"
chrono: "0.4"
pyo3: { version = "0.21", Features = ["extension-module"]
pyo3-polars: "0,18"
Я хочу, чтобы это работало:
Код: Выделить всё
use pyo3::prelude::*;
use pyo3::{Python, IntoPy};
use polars::prelude::*;
use pyo3_polars::PyDataFrame;
fn get_df() -> DataFrame{
let mut symbols: Vec = Vec::new();
let mut prices: Vec = Vec::new();
df!(
"Symbol" => &symbols,
"Price" => &prices
).unwrap()
}
fn to_python() -> PyResult {
let df:DataFrame = get_df();
let pydf = PyDataFrame(df);
Python::with_gil(|py| {
Ok(pydf)
})
}
Код: Выделить всё
error[E0308]: mismatched types
--> src/lib.rs:62:32
|
62 | let pydf = PyDataFrame(df);
| ----------- ^^ expected `polars_core::frame::DataFrame`, found `polars::prelude::DataFrame`
| |
| arguments to this struct are incorrect
|
= note: `polars::prelude::DataFrame` and `polars_core::frame::DataFrame` have similar names, but are actually distinct types
Подробнее здесь: https://stackoverflow.com/questions/792 ... hon-object
Мобильная версия