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: rewrite $head, $limit, and $tail to be equivalent to Python Polars #840

Merged
merged 5 commits into from
Feb 24, 2024

Conversation

eitsupi
Copy link
Collaborator

@eitsupi eitsupi commented Feb 24, 2024

I noticed that in Python, polars.LazyFrame.head calls the slice method internally.
https://github.com/pola-rs/polars/blob/740e740d9ce3678ea061d5cb4c2bc94892838383/py-polars/polars/lazyframe/frame.py#L4676-L4723

Here these functions are rewritten to match those in Python.
As a result, <DataFrame>$head() and <DataFrame>$tail() now support negative values.

Copy link
Collaborator

@etiennebacher etiennebacher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM, just a couple of typos.

I wonder why they keep both limit() and head() in the upstream polars if they are identical

R/lazyframe__lazy.R Outdated Show resolved Hide resolved
NEWS.md Show resolved Hide resolved
R/lazyframe__lazy.R Outdated Show resolved Hide resolved
@eitsupi
Copy link
Collaborator Author

eitsupi commented Feb 24, 2024

Thanks for your review.

I wonder why they keep both limit() and head() in the upstream polars if they are identical

It is also strange that LazyFrame in Rust seems to have limit and tail but not head.

Perhaps the reason Python has limit as well as head is to match Rust.

@eitsupi eitsupi merged commit 1710f65 into main Feb 24, 2024
24 checks passed
@eitsupi eitsupi deleted the update-limit branch February 24, 2024 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants