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

fix: Set default limit for String column display to 30 and fix edge cases #15934

Merged
merged 11 commits into from Apr 28, 2024

Conversation

stinodego
Copy link
Member

@stinodego stinodego commented Apr 27, 2024

Closes #15839

Changes

  • Set the default character limit for displaying String columns to 30
    • For DataFrames, changed from 32 to 30
    • For Series, changed from 15 to 30
  • Do not count quotes surrounding the value towards the character limit
  • Update the HTML repr (Notebooks) to match.
  • Make sure Categorical/Enum types follow the same rules (was already the case in the HTML repr).

Example

import polars as pl

with pl.Config(fmt_str_lengths=4):
    print(pl.Series(["abc", "abcd", "abcde"]))
shape: (3,)
Series: '' [str]
[
        "abc"
        "abcd"
        "abcd…    <- note: no trailing quote
]

@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Apr 27, 2024
Copy link

codecov bot commented Apr 27, 2024

Codecov Report

Attention: Patch coverage is 95.65217% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 81.26%. Comparing base (f1846a9) to head (8858a62).

Files Patch % Lines
crates/polars-core/src/fmt.rs 97.22% 1 Missing ⚠️
py-polars/src/series/mod.rs 88.88% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #15934   +/-   ##
=======================================
  Coverage   81.25%   81.26%           
=======================================
  Files        1381     1381           
  Lines      176597   176602    +5     
  Branches     3028     3028           
=======================================
+ Hits       143496   143508   +12     
+ Misses      32620    32613    -7     
  Partials      481      481           
Flag Coverage Δ
python 74.69% <95.65%> (+<0.01%) ⬆️
rust 78.38% <93.47%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@JulianCologne JulianCologne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, thanks! 🙏🏻

py-polars/polars/dataframe/_html.py Show resolved Hide resolved
@stinodego stinodego marked this pull request as ready for review April 28, 2024 04:35
@ritchie46 ritchie46 merged commit 031c926 into main Apr 28, 2024
25 of 26 checks passed
@ritchie46 ritchie46 deleted the fmt branch April 28, 2024 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change default of Config.set_fmt_str_lengths to be more reasonable (also little display "bug")
3 participants