Repository navigation
MNT polars 1.40 deprecated dataframe interchange protocol __dataframe__ - #33789
Merged
jeremiedbb merged 4 commits intoApr 23, 2026
Merged
Conversation
Member
|
I think we might want to add a changelog entry because the code change is not trivial. |
Member
Author
A fix? |
Member
|
BTW, I confirm that this should fix our circle CI build in #33804 as the following fails with |
Member
Author
|
I think the HistGradientBoosting* path is unchanged behavior (not an improvement but also no deterioration): import polars as pl
df = pl.DataFrame({
"a": [1, 2],
"b": ["a", "b"],
"c": pl.Series(["a", "b"], dtype=pl.Enum(["a", "b"])),
"d": pl.Series(["a", "b"], dtype=pl.Categorical)
})
idf = df.__dataframe__()
[c.dtype for c in idf.get_columns()]
# Out[8]:
# [(<DtypeKind.INT: 0>, 64, 'l', '='),
# (<DtypeKind.STRING: 21>, 8, 'U', '='),
# (<DtypeKind.CATEGORICAL: 23>, 32, 'I', '='),
# (<DtypeKind.CATEGORICAL: 23>, 32, 'I', '=')]So |
virchan
approved these changes
Apr 21, 2026
Member
There was a problem hiding this comment.
LGTM! Thanks, @lorentzenchr!
@ogrisel, could we merge this?
Edit: Waiting to reach consensus in #31049.
Member
|
The consensus is roughly to switch to narwhals but still merge this PR as a temporary fix |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference Issues/PRs
None
What does this implement/fix? Explain your changes.
Polars version 1.40 deprecated the dataframe interchange protocol
__dataframe__, see https://github.com/pola-rs/polars/releases/tag/py-1.40.0.This PR makes polars code path not relying on it.
AI usage disclosure
None
Any other comments?
We could treat string columns in
HistGradientBoosting*as categorical....