Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #27561 +/- ##
==========================================
- Coverage 81.44% 80.55% -0.90%
==========================================
Files 1837 1841 +4
Lines 255199 255962 +763
Branches 3179 3180 +1
==========================================
- Hits 207857 206184 -1673
- Misses 46518 48950 +2432
- Partials 824 828 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Struct dtype from qcut when "include_breaks=True" on empty series
orlp
left a comment
There was a problem hiding this comment.
Please take a look at https://docs.pola.rs/development/contributing/#first-time-contributions.
|
|
||
|
|
||
| def test_qcut_empty_include_breaks() -> None: | ||
| # https://github.com/pola-rs/polars/issues/27284 |
There was a problem hiding this comment.
Our convention is to name the test test_name_27284.
…True on empty/all-null series
The early return path in qcut for empty or all-null series always returned
bare Categorical, ignoring include_breaks. This caused a schema mismatch
when downstream code called .struct.field("breakpoint") in lazy context.
Fixes pola-rs#27284
a868fec to
61d22ef
Compare
|
Hi @kimjune01, while fixing two other qcut panics on degenerate float input (all-NaN and infinite), I found they sit in the same early-return block your PR touches, and a correct all-NaN fix also needs the struct-aware return you added here. I've opened #28220, which includes your empty-series fix (credited) alongside the two extra cases, since they can't cleanly be separated. Didn't want to step on your work; very happy to defer, combine, or adjust however you and the maintainers prefer. |
|
I'm happy to have this PR closed and fold it into yours @mkzung |
|
Superseded by #28220. |
Fixes #27284.
When a Series is empty (length 0),
qcutwithinclude_breaks=Truehits theearly-return path at
null_count() == len()(0 == 0) and returns a Categoricalcolumn instead of the expected Struct with breakpoint + category fields.
This returns a properly-typed empty
StructChunkedwith Float64 breakpoint andCategorical category fields when
include_breaksis set in the early-return path.Tests cover empty series, empty series in lazy context, and all-null series.