Repository navigation
Conversation
…n for pandas-like and pyarrow
FBruzzesi
commented
Oct 5, 2026
Comment on lines
+623
to
+626
| # `where` rather than `fillna`: pandas 3.1 deprecates filling a NumPy-backed | ||
| # literal from a nullable or pyarrow-backed `value`. | ||
| native = receiver.native | ||
| return receiver._with_native(native.where(native.notna(), value.native)) |
Comment on lines
-630
to
+647
| res_ser = self._with_native( | ||
| ser.fillna(value=native_value, **kwargs), preserve_broadcast=True | ||
| ) | ||
| result = native.fillna(value=native_value, **kwargs) | ||
| else: | ||
| res_ser = self._with_native( | ||
| ser.ffill(limit=limit, **kwargs) | ||
| result = ( | ||
| native.ffill(limit=limit, **kwargs) | ||
| if strategy == "forward" | ||
| else ser.bfill(limit=limit, **kwargs), | ||
| preserve_broadcast=True, | ||
| else native.bfill(limit=limit, **kwargs) | ||
| ) | ||
| return res_ser | ||
| return self._with_native(result, preserve_broadcast=True) |
Member
Author
There was a problem hiding this comment.
Nothing really to see here
Comment on lines
+128
to
+129
| and self._metadata.is_scalar_like | ||
| and not value._metadata.is_scalar_like |
Member
Author
There was a problem hiding this comment.
These changes are just to keep the native fill_null a native op without all the extra checks
This branch has not been deployed
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.
Description
nw.lit(None).fill_null(nw.col("a"))(and other scalar-like receivers, e.g.nw.col("a").max()) raised on pandas-like and pyarrow when used alone, and on pandas silently returned the first value repeated when selected next to a full-length column. The receiver is now broadcast to the length ofvaluebefore filling, matching Polars.This removes the xfail on
test_fill_null_scalar_receiveradded in #3972 and extends it to cover both cases.NOTE:
is_betweenhas the same bug on pandas-like and pyarrow and will be handled separately. I'd leave it out of this PR's scope.clip, but clip has bigger issues anyway to begin with, see [Bug]:Expr.clipwith a scalar-like receiver behaves differently on every backend #3964What type of PR is this? (check all applicable)