Skip to content
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

BUG: Fixed to_html with index=False and max_rows #14999

Closed

Conversation

TomAugspurger
Copy link
Contributor

closes #14998

Previously raised an IndexError by assuming that
len(fmt_values) was always the same length as len(self.data).

closes pandas-dev#14998

Previously raised an IndexError by assuming that
`len(fmt_values)` was always the same length as `len(self.data)`.
@TomAugspurger TomAugspurger added the IO HTML read_html, to_html, Styler.apply, Styler.applymap label Dec 27, 2016
@TomAugspurger TomAugspurger added this to the 0.20.0 milestone Dec 27, 2016
@codecov-io
Copy link

codecov-io commented Dec 27, 2016

Current coverage is 84.78% (diff: 100%)

Merging #14999 into master will increase coverage by <.01%

@@             master     #14999   diff @@
==========================================
  Files           145        145          
  Lines         51090      51090          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          43315      43316     +1   
+ Misses         7775       7774     -1   
  Partials          0          0          

Powered by Codecov. Last update 7f0eefc...2bd8629

@jorisvandenbossche
Copy link
Member

You now tested with max_rows=1, but am I correct that with max_rows=2 you would not get the ... row? Or if so maybe include that in the test?

@TomAugspurger
Copy link
Contributor Author

but am I correct that with max_rows=2 you would not get the ... row?

Looks like we have some issues with the interaction between index and max_rows

screen shot 2016-12-28 at 7 44 04 am

I think the third one is buggy, index=False should not affect whether or not the ... is drawn. Do that as a followup?

@jorisvandenbossche
Copy link
Member

I can as a follow-up, but possibly you can also solve it at once here. If you use the _write_regular_rows whether index is false or not, but let _write_regular_rows adapt based on that: eg extend values with index er not: https://github.com/pandas-dev/pandas/pull/14999/files#diff-893f461e63cbb3ced9ab2c53328416a0L1216 and then pass an argument to self.write_tr to specify there should be a th or not (https://github.com/pandas-dev/pandas/pull/14999/files#diff-893f461e63cbb3ced9ab2c53328416a0L1222).
But not sure how many side effects this would have that makes it more complicated. So as a follow-up is fine as well.

@jreback
Copy link
Contributor

jreback commented Dec 30, 2016

thanks @TomAugspurger

@jorisvandenbossche
Copy link
Member

Opened #15019 for the remaining issue with the truncation

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DataFrame.to_html with max_rows and index=False raises IndexError
4 participants