posit-dev / great-tables

Make awesome display tables using Python.
https://posit-dev.github.io/great-tables/
MIT License
1.42k stars 48 forks source link

fix: refactor column selection logic for `Polars` #360

Closed jrycw closed 1 month ago

jrycw commented 1 month ago

Related to #340, pola-rs/polars#16242, pola-rs/polars#16250.

This PR provides a quick fix for the column selection logic in Polars. Further investigation may be needed from the team.

codecov-commenter commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 85.74%. Comparing base (b290e66) to head (7a7f825). Report is 10 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #360 +/- ## ========================================== + Coverage 84.72% 85.74% +1.02% ========================================== Files 41 41 Lines 4346 4328 -18 ========================================== + Hits 3682 3711 +29 + Misses 664 617 -47 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

machow commented 1 month ago

Shoot, thanks for catching this! It seems like there are three behaviors in the new polars release that broke our current approach (afaict this is just a side-effect of us living on the bleeding edge of expand_selector() 😈 ):

  1. quick fix: expand_selector() no longer accepts a list
  2. quick fix: expand_selector() no long accepts a raw string or int
  3. bigger discussion: expand_selector() only sometimes considers .exclude() a selector

I've opened an issue on polars RE the .exclude() behavior:

machow commented 1 month ago

Here is the docs preview I've pushed to a branch:

https://docs-preview-test--gt-python.netlify.app/articles/intro.html

jrycw commented 1 month ago

@machow and @rich-iannone , everything looks great. It seems the developers from Polars are actively supporting and clarifying our use case, which is fantastic.