enhancement: Interpolate_by support float in the by column + extrapolate_flat option #17952
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.
This addresses https://github.com/pola-rs/polars/issues/16794. Floats are now supported in the by expression of interpolate_by, and I also added the ability to extrapolate in the regions before and after the start of the by column, by just extending the lowest/highest value of the expressions (consistent with numpy interp function defaults, I believe).
This is my first PR, so I'm not totally sure what's going on. Running the test suite yields many failures, but most of them seem very unlikely to be related to my changes.
One test that is failing in test_interpolate_by. It is not correctly raising the error that it is looking for here:
But I am having trouble understanding where this code goes or debugging it, tbh. Anyway, hoping someone can help.