Skip to content

Commit

Permalink
fix: Fix categorical
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Sep 12, 2024
1 parent 632776a commit 0a30709
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions pyo3-polars/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ use super::*;
use crate::error::PyPolarsErr;
use crate::ffi::to_py::to_py_array;
use polars::export::arrow;
#[cfg(feature = "dtype-categorical")]
use polars_core::datatypes::create_enum_data_type;
use polars_core::datatypes::{CompatLevel, DataType};
use polars_core::prelude::*;
use polars_core::utils::materialize_dyn_int;
Expand Down Expand Up @@ -592,7 +590,7 @@ impl<'py> FromPyObject<'py> for PyDataType {
let s = get_series(&categories.as_borrowed())?;
let ca = s.str().map_err(PyPolarsErr::from)?;
let categories = ca.downcast_iter().next().unwrap().clone();
create_enum_data_type(categories)
DataType::Enum(Some(RevMapping::build_local(categories)), Default::default())
},
"Date" => DataType::Date,
"Time" => DataType::Time,
Expand Down

0 comments on commit 0a30709

Please sign in to comment.