Skip to content

BUG: DataFrame.to_html() fails when index=False and max_rows is specified #8290

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
wants to merge 3 commits into from

Conversation

onesandzeroes
Copy link
Contributor

This addresses #8273, but it doesn't actually fully fix the issue, since the same bug still occurs when we have a MultiIndex. I've got a fix for the single-index case, and I'm not sure if I have time to decipher what's happening with hierarchical indexes right now. I'll open a new issue for the MultiIndex case if that's OK, having a MultiIndexed dataframe and then not printing the index seems like a bit of an edge case to me anyway.

import pandas as pd
import numpy as np

df = pd.DataFrame({'a': np.arange(0, 10), 'b': np.arange(9, -1, -1)})
df.to_html(max_rows=3, index=False)

now produces:

a b
0 9
... ...
9 0

as expected.

@jreback jreback added IO HTML read_html, to_html, Styler.apply, Styler.applymap Output-Formatting __repr__ of pandas objects, to_string labels Sep 17, 2014
@jreback jreback modified the milestone: Next Major Release Mar 2, 2015
@jreback
Copy link
Contributor

jreback commented May 9, 2015

closing pls reopen if/when updated

@jreback jreback closed this May 9, 2015
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

Successfully merging this pull request may close these issues.

2 participants