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

Support using polars.element() like a lambda for various calculations #251

Open
machow opened this issue Mar 21, 2024 · 0 comments
Open

Comments

@machow
Copy link
Collaborator

machow commented Mar 21, 2024

Functions like fmt_nanoplot() have arguments that support calculation expressions on data. For example, reference_line= can take arguments like "min", which then calculates the min.

It would be great if we could just take a polars expression there. One issue is that afaik there isn't a way to pass an "anonymous" expression in polars. Meaning, an expression that says "do this set of calculations to some unnamed Series, that will be specified later".

However, a very similar mechanism exists for lists already in polars. You can use polars.element() to essentially do the above, for each list in a column with a schema like List[*].

I wonder if there's a way to tap into this mechanism more generally? E.g.

# pretty good, but not as extensible ---
GT(...).fmt_nanoplot(reference_line="min")

#  plz we need it ---
GT(...).fmt_nanoplot(reference_line=pl.element().min())

(I could be missing another feature in polars that does this already)

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

No branches or pull requests

1 participant