From aaf0a1122b788fc9a6fe6cf29cc0712367efbe91 Mon Sep 17 00:00:00 2001 From: barak1412 Date: Fri, 1 Nov 2024 10:09:06 +0200 Subject: [PATCH] fix: Correct categorical namespace error message (#19558) --- .../polars-plan/src/plans/conversion/type_coercion/functions.rs | 2 +- py-polars/tests/unit/datatypes/test_categorical.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/polars-plan/src/plans/conversion/type_coercion/functions.rs b/crates/polars-plan/src/plans/conversion/type_coercion/functions.rs index c7b738722c55..a62f9515b59a 100644 --- a/crates/polars-plan/src/plans/conversion/type_coercion/functions.rs +++ b/crates/polars-plan/src/plans/conversion/type_coercion/functions.rs @@ -74,7 +74,7 @@ fn check_namespace(function: &FunctionExpr, first_dtype: &DataType) -> PolarsRes }, #[cfg(feature = "dtype-categorical")] FunctionExpr::Categorical(_) => { - polars_ensure!(matches!(first_dtype, DataType::Categorical(_, _)), InvalidOperation: "expected Struct type, got: {}", first_dtype) + polars_ensure!(matches!(first_dtype, DataType::Categorical(_, _)), InvalidOperation: "expected Categorical type, got: {}", first_dtype) }, _ => {}, } diff --git a/py-polars/tests/unit/datatypes/test_categorical.py b/py-polars/tests/unit/datatypes/test_categorical.py index f8750f9e2a95..7847081689e6 100644 --- a/py-polars/tests/unit/datatypes/test_categorical.py +++ b/py-polars/tests/unit/datatypes/test_categorical.py @@ -837,7 +837,7 @@ def test_cat_append_lexical_sorted_flag() -> None: def test_get_cat_categories_multiple_chunks() -> None: df = pl.DataFrame( [ - pl.Series("e", ["a", "b"], pl.Enum(["a", "b"])), + pl.Series("e", ["a", "b"], pl.Categorical), ] ) df = pl.concat(