-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(python): Panic on empty df / null List(Categorical) #16730
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #16730 +/- ##
==========================================
- Coverage 81.45% 81.44% -0.01%
==========================================
Files 1413 1413
Lines 186096 186187 +91
Branches 2776 2776
==========================================
+ Hits 151588 151645 +57
- Misses 33988 34022 +34
Partials 520 520 ☔ View full report in Codecov by Sentry. |
@@ -84,9 +84,12 @@ impl Series { | |||
#[cfg(feature = "dtype-categorical")] | |||
dt @ (Categorical(rev_map, ordering) | Enum(rev_map, ordering)) => { | |||
let cats = UInt32Chunked::from_chunks(name, chunks); | |||
let rev_map = rev_map | |||
.clone() | |||
.unwrap_or_else(|| Arc::new(RevMapping::default())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should assert cats
is emtpy if we set an empty rev map.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe should add it directly in from_cats_and_rev_map_unchecked
under cfg(debug_assertions)?
But this seems to be the only place when they're unwrapped, so I added it just here for now.
Thanks! |
Fix: #16405