-
Notifications
You must be signed in to change notification settings - Fork 36
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: <DataFrame>$partition_by()
#898
Conversation
fa79a0b
to
bb344c8
Compare
..., | ||
maintain_order = TRUE, | ||
include_key = TRUE, | ||
as_nested_list = FALSE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this name appropriate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I think it is the best equivalent to Python's dict
<DataFrame>
$partition_by() [skip ci]<DataFrame>$partition_by()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, some comments. Can you also bump NEWS?
..., | ||
maintain_order = TRUE, | ||
include_key = TRUE, | ||
as_nested_list = FALSE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I think it is the best equivalent to Python's dict
#' Convert dots to a character vector of column names | ||
#' @param .df [RPolarsDataFrame] | ||
#' @param ... Arguments to pass to [`pl$col()`][pl_col] | ||
#' @noRd | ||
dots_to_colnames = function(.df, ..., .call = sys.call(1L)) { | ||
result(pl$DataFrame(schema = .df$schema)$select(pl$col(...))$columns) |> | ||
unwrap(call = .call) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised this wasn't needed before , I think DataFrame$drop()
should have a similar input as DataFrame$partition_by()
based on the py-polars API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@etiennebacher Could you update $drop()
?
Co-authored-by: Etienne Bacher <[email protected]>
@etiennebacher Thanks for your review. |
Close #891
Perhaps rather than adding a method to GroupBy, DataFrame's partition_by is sufficient.
Created on 2024-03-09 with reprex v2.1.0