-
Notifications
You must be signed in to change notification settings - Fork 38
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
refactor!: rename <Expr>$lit_to_s()
to <Expr>$to_series()
and remove <Expr>$lit_to_df()
#582
Conversation
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.
This is fine for me but I'd like @sorhawell to take a look too
I disagree with dropping How about keeping I find it very practical and is one of my favorite methods. All the tests become more verbose by using
Neither do
That is because only the subvarient Expr::Literal or (Expr derived thereof) can be converted into a Series. I prefixed lit_ point this out. #example of non literal conversion to Series
> as_polars_series(pl$col())
Error: Execution halted with the following contexts
0: In R: in $select()
0: During function call [as_polars_series(pl$col())]
1: Encountered the following error in Rust-Polars:
not found:
Error originated just after this operation:
DF []; PROJECT */0 COLUMNS; SELECTION: "None" We can drop the prefix lit, but documentation should state that it will cause an error converting non Literal-derived expressions to Series. We can consider change to
agreed but that could be resolved by renaming to |
a use case for s = pl$Series[1:3]
s$
to_lit[]$
# work with a Series as a Literal
cast[pl$Float64]$
lit_to_s[]$
# back to Series interface
append[4]$
chunk_lengths[]
[1] 3 1 sry for hard brackets I got my self hooked tab-complete heaven :) |
I see. |
sounds good to my ears :) |
be65cf9
to
32b0f12
Compare
<Expr>$lit_to_s()
and <Expr>$lit_to_df()
in favor of as_polars_*
<Expr>$lit_to_s()
to <Expr>$to_series()
and remove <Expr>$lit_to_df()
b56711b
to
e746ac4
Compare
@sorhawell I have updated. Could you take a look at this? |
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.
looks good to me :)
$to_*
instead of$lit_to_*
)So I think it is better to remove them.