Skip to content

How to align title and value? #7968

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

Closed
vortexroc opened this issue Aug 9, 2014 · 4 comments
Closed

How to align title and value? #7968

vortexroc opened this issue Aug 9, 2014 · 4 comments

Comments

@vortexroc
Copy link

if i use the chinese as column name,the column names and values could not be aligned,like this:
image

@TomAugspurger
Copy link
Contributor

Are all of those characters the same fixed width as the numbers below?

It's putting in the 'correct' number of padding spaces, assuming the characters are fixed width:

In [39]: df
Out[39]: 
   丂丅丆七  丈三上丌万下丈
0     0        1
1     0        1
2     0        1

In [40]: en
Out[40]: 
   aaaa  bbbbbbb
0     0        1
1     0        1
2     0        1

In [41]: str(df)
Out[41]: '   丂丅丆七  丈三上丌万下丈\n0     0        1\n1     0        1\n2     0        1'

In [42]: str(en)
Out[42]: '   aaaa  bbbbbbb\n0     0        1\n1     0        1\n2     0        1'

In [43]: str(en).count(' ')
Out[43]: 44

In [44]: str(df).count(' ')
Out[44]: 44

@vortexroc
Copy link
Author

The character's twice the number's width,so i can't solve this problem.

@TomAugspurger
Copy link
Contributor

Ok. You may have more luck in the IPython notebook, since those are in HTML. My example looks a lot nicer.

I'm going to close this issue since I don't think there's any realistic way to get the character width in python.

@sinhrks
Copy link
Member

sinhrks commented Aug 9, 2014

This is a dupe of #2612.

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

No branches or pull requests

3 participants