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(python): Truncate long column name in glimpse #8281

Merged
merged 1 commit into from
Apr 16, 2023

Conversation

zundertj
Copy link
Collaborator

Truncate column names longer than 50 characters to 47 characters + "...".

Extremely long column names (say 90+ characters, depending on dtypes present) caused an issue as max_col_values would become negative. Truncating to 50, plus 10? for dtypes leaves always 100-50-10=40 characters for the first couple of values.

Tried to see if textwrap.shorten (in stdlib) would be of use, but that works only for words in a sentence, not characters, unfortunately.

Fixes #8273.

Truncate column names longer than 50 characters to 47 characters + "...".

Extremely long column names (say 90+ characters, depending on dtypes present) caused an issue as `max_col_values` would become negative. Truncating to 50, plus 10? for dtypes leaves always 100-50-10=40 characters for the first couple of values.
@github-actions github-actions bot added fix Bug fix python Related to Python Polars labels Apr 16, 2023
@ritchie46 ritchie46 merged commit 4bd37ed into pola-rs:main Apr 16, 2023
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

glimpse() fails for lengthy column names
2 participants