You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thread '<unnamed>' panicked at 'assertion failed: i < self.len()', /root/.cargo/git/checkouts/arrow2-945af624853845da/baa2618/src/array/utf8/mod.rs:155:9
I tried using the global string cache, and it still fails:
with pl.StringCache():
pl.Series("foo", [["a"], ["a", "b"]]).arr.eval(pl.element().cast(pl.Categorical))
but with a slightly different error:
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /home/runner/work/polars/polars/polars/polars-core/src/chunked_array/logical/categorical/builder.rs:91:28
Polars version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of Polars.
Issue description
When building arrays of categorical vars, I get PanicExceptions if not all the levels are present in the first array.
fails with:
but this works just fine:
I tried using the global string cache, and it still fails:
but with a slightly different error:
Reproducible example
Expected behavior
As I mention in #6003, it'd be best to be able to directly cast to pl.List(pl.Categorical), without needing .arr.eval:
But this just results in nulls:
Installed versions
The text was updated successfully, but these errors were encountered: