-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
BUG: Print alignement problem with some unicode characters #61502
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
Comments
The misalignment seems to be happening because pandas calculates column widths using I tried patching this locally by using With those changes, the alignment now works as expected even with emojis. I’d love to open a PR for this, just wanted to check first if maintainers would be okay with using |
Thanks a lot @iabhi4 ! I didn't knew about that library, it sounds very useful. I'm just curious about the amount of code used by this solution and the extensive auto generated modules: wouldn't it affect too mush the performance ? Can't it be simpler ? No criticism, just questioning. |
Totally fair to ask, I was also a bit unsure at first about adding more complexity, especially with an external library. But That said, you’re right about performance, calling Really appreciate you raising this, I’m totally open to feedback and happy to explore simpler solutions if there's a better way! |
Thanks a lot everybody. I don't know a lot about Unicode, but I'm pretty sure that rules computation can be implemented without adding another dependance. It could also be feasible in C or cython to keep good performances. While investigating, I've found an interesting explanation, out of a Rust lib. Now, the one billion dollars question: is it the good place to fix it in pandas, or would it be better to be associated with python? ... And the sub question: what is the reason why python has implemented |
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
The example prints the following output:
It seems that some unicode characters are shifting the position to the right.
I have tried with different ranges (number of used bytes), and I can't find where the issue comes from.
Expected Behavior
(well, there's also an alignement problem on github, but the "1" shall be aligned)
Installed Versions
The text was updated successfully, but these errors were encountered: