diff --git a/crates/polars-ops/src/series/ops/index_of.rs b/crates/polars-ops/src/series/ops/index_of.rs index 369b397cda24..65ca03c978c9 100644 --- a/crates/polars-ops/src/series/ops/index_of.rs +++ b/crates/polars-ops/src/series/ops/index_of.rs @@ -104,7 +104,8 @@ pub fn index_of(series: &Series, needle: Scalar) -> PolarsResult> } if series.dtype().is_categorical() { - unimplemented!("Categorical index_of() can give incorrect result until https://github.com/pola-rs/polars/issues/20318 is fixed") + // See https://github.com/pola-rs/polars/issues/20318 + polars_bail!(InvalidOperation: "index_of() on Categoricals is not supported"); } // For non-numeric dtypes, we convert to row-encoding, which essentially has