question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Seems a bug for the layout for the Chinese Character

See original GitHub issue

With Chinese characters in the DataFrame, it seems the tabulate package cannot identify the correct width.

import pandas as pd
import tabulate

print(tabulate.__version__)
print(tabulate.WIDE_CHARS_MODE)
df = pd.DataFrame({
    '序号':['001', '021', '032'],
    '类型': ['汽车TESLA', '飞机737-MAX', 'TRAIN'],
    '备注': ['特殊', '一长串字符', '字符+1020']
})
print(tabulate.tabulate(df, tablefmt="github"))

The Output is : 0.8.7 True |—|-----|-------------|------------| | 0 | 001 | 汽车TESLA | 特殊 | | 1 | 021 | 飞机737-MAX | 一长串字符 | | 2 | 032 | TRAIN | 字符+1020 | Screen Shot 2020-04-21 at 12 58 57 AM

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
sidkangcommented, Jun 2, 2020

@sidkang: maybe you have multiple python environments, from your Juperlab, are you able to successfully import wcwidth? if not, try

import subprocess, sys
subprocess.check_call([sys.executable, "-mpip", "install", "wcwidth"])

best wishes

Just checked the wcwidth package. Seems it is working properly.

image

1reaction
pasenorcommented, May 31, 2020

@sidkang can you check if you have wcwidth at all installed (pip freeze | grep wcwidth)? It is an optional dependency, so python-tabulate would work happily without it, but the wide character alignment would be off. For example, my output with and without wcwidth: image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problems with Chinese characters entered in layout window in ...
When a Chinese character text is created on a layout window and saved. It looks ok. ... But if the workspace is re-opened,...
Read more >
Chinese symbol: 蟲, 虫, bug; worm; insect
Chinese symbol 蟲, 虫 in calligraphy format and mp3 pinyin pronunciation, English interpretations: bug; worm; insect.
Read more >
Inconsistent rendering of Chinese characters - Bugzilla@Mozilla
I've been able to pinpoint the problem I think. When a web page doesn't specify a Chinese font in their CSS rules, Firefox...
Read more >
Chinese Font auto layout bug - Figma Community Forum
When I use Chinese characters in the auto layout, I change the Text(Hug contents ... folded and will only appear on one line...
Read more >
Email message body is garbled when Simplified Chinese ...
You create an email message with Simplified Chinese characters in the BCC field, ... In the Message format section, click International Options.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found