-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
docs(python): Add example for Config.set_tbl_width_chars
#15566
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #15566 +/- ##
==========================================
- Coverage 81.15% 81.12% -0.03%
==========================================
Files 1367 1367
Lines 175313 174934 -379
Branches 2530 2530
==========================================
- Hits 142282 141923 -359
+ Misses 32555 32537 -18
+ Partials 476 474 -2 ☔ View full report in Codecov by Sentry. |
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, but this is not a very 'useful' example. When would I want to truncate ints/floats like this?
It would be nice to get an example that shows real life usage. Now I'm wondering when you'd want to use this feature...
Note that the option is currently bugged and doesn't really work well: #6447
py-polars/polars/config.py
Outdated
... } | ||
... ) | ||
>>> pl.Config.set_tbl_width_chars(16) # doctest: +SKIP | ||
# ... |
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.
Could you put the before/after on a different line of code? Then we can actually run the examples and make sure they are correct.
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 for the feedback. I will try a better example that helps rather than hinders readability and put it on different lines so it can be checked with doctest.
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 for the PR! However, as @stinodego is suggesting, could you modify the example so that, instead of the Config option making the table layout less readable, it makes it more readable? Would probably be clearer to use longer string values to demonstrate this 🤔
Thanks @alexander-beedie that is a helpful suggestion and gives me an idea for how to improve the example. I will see what I can do. |
5590150
to
b98c9dd
Compare
CodSpeed Performance ReportMerging #15566 will not alter performanceComparing Summary
|
I honestly think #6447 must be addressed before we can add an example. The result of the example is just clearly wrong. EDIT: Actually, it's almost correct (13 chars instead of 12). Good enough for now, I suppose. Thanks for the PR! Good to merge. |
FYI: 13 is the hard minimum here as it can't compress the 3-letter dtypes any further ;) |
A portion of #13161.
Adds an example for
Config.set_tbl.width_chars
. Format is similar to other examples in file with before/after tables shown side by side, so skipped doctest. Happy to change the format for the example if preferred though.