feat(expr-ir): Add linear_space
#3349
Merged
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
This one started as a plan to expose the
linear_spaceI adapted fromnp.linspace.I added that for use in
hist, where onmainthere is currently a dependency onnp.linspace.Show usage
narwhals/narwhals/_plan/arrow/functions.py
Lines 1579 to 1587 in f50278d
narwhals/narwhals/_plan/arrow/expr.py
Lines 742 to 749 in f50278d
narwhals/narwhals/_arrow/series.py
Lines 1161 to 1171 in c119546
However, after l'd ported the
polars.linear_spacetests and noticing the direct comparison tonp.linspace- I got ... curiousSo I did my digging and found the polars rust impl - which was a lot cleaner in handling
ClosedInterval. So, I stole that instead 😄I'm deferring support on these for now:
num_sumples: IntoExprColumnpolars.linear_spacedocs have an example withnum_samples=pl.len()which seems useful{start,end}: TemporalLiteral(and temporal expressions)Timecase will work similarly toDatein (feat(expr-ir): Adddate_range, support{date,int}_range(eager=...)#3294)DateandDatetimeI don't wanna think aboutRelated issues
ArrowExpr#3325date_range, support{date,int}_range(eager=...)#3294