Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(python): Add lazy support for pl.select #20091

Merged
merged 2 commits into from
Dec 3, 2024

Conversation

alexander-beedie
Copy link
Collaborator

@alexander-beedie alexander-beedie commented Dec 1, 2024

Minor extension to pl.select, adding "eager" parameter so it can also operate in lazy mode and produce LazyFrames.

(Slightly ironically this function is already found in ".../functions/lazy.py" 😄)

Example

import polars as pl

lf = pl.select(n=pl.int_range(10, 0, -1), eager=False)
lf.filter((pl.col("n") % 3) == 0).collect()
# shape: (3, 1)
# ┌─────┐
# │ n   │
# │ --- │
# │ i64 │
# ╞═════╡
# │ 9   │
# │ 6   │
# │ 3   │
# └─────┘
FILTER [([(col("n")) % (3)]) == (0)] FROM
   SELECT [dyn int: 10.int_range([dyn int: 0]).alias("n")] FROM
    DF []; PROJECT */0 COLUMNS; SELECTION: None

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars labels Dec 1, 2024
Copy link

codecov bot commented Dec 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.52%. Comparing base (1f104f9) to head (66fa291).
Report is 25 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #20091      +/-   ##
==========================================
- Coverage   79.53%   79.52%   -0.01%     
==========================================
  Files        1563     1563              
  Lines      217124   217187      +63     
  Branches     2464     2465       +1     
==========================================
+ Hits       172680   172716      +36     
- Misses      43884    43910      +26     
- Partials      560      561       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ritchie46 ritchie46 merged commit cf3b47f into pola-rs:main Dec 3, 2024
12 checks passed
@alexander-beedie alexander-beedie deleted the lazy-select branch December 3, 2024 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants