Skip to content

Commit

Permalink
Fix compilation errors for features: dtype-struct and dtype-full (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeshingles authored Aug 16, 2024
1 parent a40590d commit a535465
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyo3-polars/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ thiserror = "1"
[features]
lazy = ["polars/serde-lazy", "polars-plan", "polars-lazy/serde", "ciborium"]
derive = ["pyo3-polars-derive", "polars-plan", "polars-ffi", "serde-pickle", "serde"]
dtype-full = ["polars/dtype-full", "dtype-decimal", "dtype-array", "dtype-categorical"]
dtype-full = ["polars/dtype-full", "dtype-decimal", "dtype-array", "dtype-struct", "dtype-categorical"]
object = ["polars/object"]
dtype-decimal = ["polars/dtype-decimal"]
dtype-struct = ["polars/dtype-struct"]
Expand Down
6 changes: 4 additions & 2 deletions pyo3-polars/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ impl ToPyObject for PyDataType {
let categories = rev_map.as_ref().unwrap().get_categories();
let class = pl.getattr(intern!(py, "Enum")).unwrap();
let s = Series::from_arrow("category", categories.clone().boxed()).unwrap();
let series = to_series(py, s.into());
let series = to_series(py, PySeries(s));
return class.call1((series,)).unwrap().into();
}
DataType::Time => pl.getattr(intern!(py, "Time")).unwrap().into(),
Expand Down Expand Up @@ -577,7 +577,9 @@ impl<'py> FromPyObject<'py> for PyDataType {
let ordering = match ordering.extract::<&str>()? {
"physical" => CategoricalOrdering::Physical,
"lexical" => CategoricalOrdering::Lexical,
ordering => PyValueError::new_err(format!("invalid ordering argument: {ordering}"))
ordering => {
return Err(PyValueError::new_err(format!("invalid ordering argument: {ordering}")))
}
};

DataType::Categorical(None, ordering)
Expand Down

0 comments on commit a535465

Please sign in to comment.