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

BUG: fixes data table alignment when emojis are present #58311

Closed
wants to merge 2 commits into from

Conversation

madhuramkumar
Copy link

@madhuramkumar madhuramkumar commented Apr 18, 2024

Data tables were misaligned when there were emojis present. This was because the "display.unicode.east_asian_width" setting that already exists was not being set to true when emojis were present. Added code in format.py -> _make_fixed_width() to check whether or not an emoji is present, then set the above display setting to true accordingly.

Copy link
Member

@mroeschke mroeschke left a 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. I haven't dug into deeply into the original issue, but possibly it might be a won't fix if it requires a global set option which should be done by the user


emoji_count = sum(len(emoji_pattern.findall(s)) for s in strings)
if emoji_count > 0:
set_option("display.unicode.east_asian_width", True)
Copy link
Member

Choose a reason for hiding this comment

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

Modifying global setting silently for users is probably not a great user experience as it can lead to silent bugs.

@mroeschke
Copy link
Member

Thanks for this PR but I think an appropriate solution needs iterating on the original issue first so closing this PR

@mroeschke mroeschke closed this May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Problem with column header text alignment when printing df that contains emojis
2 participants