Skip to content

MultiIndex column headings misaligned in to_html(index=False) #4896

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
patricksurry opened this issue Sep 20, 2013 · 1 comment
Closed

MultiIndex column headings misaligned in to_html(index=False) #4896

patricksurry opened this issue Sep 20, 2013 · 1 comment
Labels
IO HTML read_html, to_html, Styler.apply, Styler.applymap Output-Formatting __repr__ of pandas objects, to_string

Comments

@patricksurry
Copy link

Dropping the index column with index=False normally works OK, but if the column headings are from a MultiIndex, it fails to drop the empty <th></th> spacers at the start of the header, so data rows are not aligned properly:

df = pd.DataFrame([[1,1],[1,2],[2,3]], 
                  columns=pd.MultiIndex.from_tuples([('a','b'),('a', 'c')]))
df.to_html(index=False)
@jreback jreback modified the milestones: 0.15.0, 0.14.0 Mar 28, 2014
@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 3, 2015
@kokes
Copy link
Contributor

kokes commented Mar 2, 2016

Duplicated in #10344, fixed in 0.17.0. (Check out this gist that replicates your code.)

@jreback jreback closed this as completed Mar 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO HTML read_html, to_html, Styler.apply, Styler.applymap Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

No branches or pull requests

3 participants