Skip to content

Commit

Permalink
Pyo3Polars 0.18/0.11 -> Rust Polars 0.44 (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 authored Oct 28, 2024
1 parent d426148 commit a6a37ef
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 18 deletions.
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ members = [
]

[workspace.dependencies]
polars = { version = "0.43.0", default-features = false }
polars-core = { version = "0.43.0", default-features = false }
polars-ffi = { version = "0.43.0", default-features = false }
polars-plan = { version = "0.43.0", default-feautres = false }
polars-lazy = { version = "0.43.0", default-features = false }
polars = { version = "0.44.0", default-features = false }
polars-core = { version = "0.44.0", default-features = false }
polars-ffi = { version = "0.44.0", default-features = false }
polars-plan = { version = "0.44.0", default-feautres = false }
polars-lazy = { version = "0.44.0", default-features = false }

[workspace.dependencies.arrow]
package = "polars-arrow"
version = "0.43.0"
version = "0.44.0"
path = "../polars/crates/polars-arrow"
default-features = false

Expand Down
2 changes: 1 addition & 1 deletion example/derive_expression/expression_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ crate-type = ["cdylib"]

[dependencies]
polars = { workspace = true, features = ["fmt", "dtype-date", "timezones"], default-features = false }
pyo3 = { version = "0.22.2", features = ["abi3-py38"] }
pyo3 = { version = "0.21", features = ["abi3-py38"] }
pyo3-polars = { version = "*", path = "../../../pyo3-polars", features = ["derive"] }
rayon = "1.7.0"
serde = { version = "1", features = ["derive"] }
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ crate-type = ["cdylib"]
polars = { workspace = true, features = ["fmt"] }
polars-core = { workspace = true }
polars-lazy = { workspace = true }
pyo3 = { version = "0.22.2", features = ["extension-module"] }
pyo3 = { version = "0.21", features = ["extension-module"] }
pyo3-polars = { version = "*", path = "../../../pyo3-polars", features = ["lazy"] }
rayon = "1.10"
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ pub(super) fn parallel_jaccard(df: DataFrame, col_a: &str, col_b: &str) -> Polar
let a = sub_df.column(col_a)?;
let b = sub_df.column(col_b)?;

let out = compute_jaccard_similarity(a, b)?;
let out =
compute_jaccard_similarity(a.as_materialized_series(), b.as_materialized_series())?;

df!(
"jaccard" => out
Expand Down
2 changes: 1 addition & 1 deletion example/io_plugin/io_plugin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ crate-type = ["cdylib"]

[dependencies]
polars = { workspace = true, features = ["fmt", "dtype-date", "timezones", "lazy"], default-features = false }
pyo3 = { version = "0.22.2", features = ["abi3-py38"] }
pyo3 = { version = "0.21", features = ["abi3-py38"] }
pyo3-polars = { version = "*", path = "../../../pyo3-polars", features = ["derive", "lazy"] }
rand = { version = "0.8.5", features = [] }
1 change: 1 addition & 0 deletions example/io_plugin/io_plugin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ impl RandomSource {
// Apply slice pushdown.
// This prevents unneeded sampling.
s.next_n(std::cmp::min(self.size_hint, self.n_rows))
.into_column()
})
.collect::<Vec<_>>();

Expand Down
2 changes: 1 addition & 1 deletion pyo3-polars-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyo3-polars-derive"
version = "0.11.0"
version = "0.12.0"
edition = "2021"
license = "MIT"
readme = "README.md"
Expand Down
6 changes: 3 additions & 3 deletions pyo3-polars/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyo3-polars"
version = "0.17.0"
version = "0.18.0"
edition = "2021"
license = "MIT"
readme = "../README.md"
Expand All @@ -18,8 +18,8 @@ polars-core = { workspace = true, default-features = false }
polars-ffi = { workspace = true, optional = true }
polars-lazy = { workspace = true, optional = true }
polars-plan = { workspace = true, optional = true }
pyo3 = "0.22.2"
pyo3-polars-derive = { version = "0.11.0", path = "../pyo3-polars-derive", optional = true }
pyo3 = "0.21"
pyo3-polars-derive = { version = "0.12.0", path = "../pyo3-polars-derive", optional = true }
serde = { version = "1", optional = true }
serde-pickle = { version = "1", optional = true }
thiserror = "1"
Expand Down
11 changes: 7 additions & 4 deletions pyo3-polars/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,13 @@ impl<'a> FromPyObject<'a> for PyDataFrame {
for pyseries in series.iter()? {
let pyseries = pyseries?;
let s = pyseries.extract::<PySeries>()?.0;
columns.push(s);
columns.push(s.into_column());
}
unsafe {
Ok(PyDataFrame(DataFrame::new_no_checks_height_from_first(
columns,
)))
}
unsafe { Ok(PyDataFrame(DataFrame::new_no_checks(columns))) }
}
}

Expand Down Expand Up @@ -304,7 +308,7 @@ impl IntoPy<PyObject> for PyDataFrame {
.0
.get_columns()
.iter()
.map(|s| PySeries(s.clone()).into_py(py))
.map(|s| PySeries(s.as_materialized_series().clone()).into_py(py))
.collect::<Vec<_>>();

let polars = POLARS.bind(py);
Expand Down Expand Up @@ -508,7 +512,6 @@ impl<'py> FromPyObject<'py> for PyDataType {
fn extract_bound(ob: &Bound<'py, PyAny>) -> PyResult<Self> {
let py = ob.py();
let type_name = ob.get_type().qualname()?;
let type_name = type_name.to_cow()?;

let dtype = match type_name.as_ref() {
"DataTypeClass" => {
Expand Down

0 comments on commit a6a37ef

Please sign in to comment.