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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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 (23b2fa4).
Report is 1 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   217125       +1     
  Branches     2464     2464              
==========================================
- Hits       172680   172679       -1     
- Misses      43884    43886       +2     
  Partials      560      560              

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

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.

1 participant