-
Notifications
You must be signed in to change notification settings - Fork 76
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: add style.from_column, implement for loc.body #83
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 great! I think the main changes needed (as discussed) are: (1) having from_column()
is not part of style
, (2) enabling support for pl.col()
from Polars.
Alright, now we have:
Note that I added a new internal class called FromValues, to represent a materialized column of values (e.g. from the polars Series that results from executing the polars expression). I didn't move FromColumn out of (down for anything though!) |
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.
LGTM!!!
noyce |
This PR implements the
from_column()
behavior from gt, which allows for setting a style based on values in the data.e.g.
NOTES:
loc.body()
, raises if you try to use it withloc.title()
fmt_*
function. This PR puts the handling insideset_style
, by implementing a CellStyle._from_row() method. This gives each style the chance to return a new version of itself based on the data, just before setting it on the GT object.style.from_column()
, but another place it could go is with helpers likemd()
at the top-level of the package?