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: User-facing AssertionError with DataFrame.to_html(classes=<invalid type>) #25608

Closed
simonjayhawkins opened this issue Mar 8, 2019 · 3 comments

Comments

@simonjayhawkins
Copy link
Member

commented Mar 8, 2019

Code Sample, a copy-pastable example if possible

import pandas as pd
pd.DataFrame().to_html(classes=True)

Problem description

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\simon\OneDrive\code\pandas-simonjayhawkins\pandas\core\frame.py", line 2212, in to_html
    formatter.to_html(classes=classes, notebook=notebook, border=border)
  File "C:\Users\simon\OneDrive\code\pandas-simonjayhawkins\pandas\io\formats\format.py", line 729, in to_html
    html = Klass(self, classes=classes, border=border).render()
  File "C:\Users\simon\OneDrive\code\pandas-simonjayhawkins\pandas\io\formats\html.py", line 146, in render
    self._write_table()
  File "C:\Users\simon\OneDrive\code\pandas-simonjayhawkins\pandas\io\formats\html.py", line 167, in _write_table
    .format(typ=type(self.classes)))
AssertionError: classes must be list or tuple, not <class 'bool'>

Expected Output

TypeError: classes must be a string, list or tuple, not <class 'bool'>

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]

@simonjayhawkins

This comment has been minimized.

Copy link
Member Author

commented Mar 8, 2019

@mroeschke : the solution requires a change to one line of code, add a simple parametrised test and a whatsnew entry under bugfix. Can this be labelled good first issue?

@mroeschke

This comment has been minimized.

Copy link
Member

commented Mar 8, 2019

Thanks for the suggestion!

@ArtificialQualia

This comment has been minimized.

Copy link
Contributor

commented Mar 9, 2019

I can work on this

ArtificialQualia added a commit to ArtificialQualia/pandas that referenced this issue Mar 9, 2019

@jreback jreback added this to the 0.25.0 milestone Mar 10, 2019

jreback added a commit that referenced this issue Mar 10, 2019

thoo added a commit to thoo/pandas that referenced this issue Mar 11, 2019

Merge remote-tracking branch 'upstream/master' into pivot
* upstream/master: (110 commits)
  DOC: hardcode contributors for 0.24.x releases (pandas-dev#25662)
  DOC: restore toctree maxdepth (pandas-dev#25134)
  BUG: Redefine IndexOpsMixin.size, fix pandas-dev#25580. (pandas-dev#25584)
  BUG: to_csv line endings with compression (pandas-dev#25625)
  DOC: file obj for to_csv must be newline='' (pandas-dev#25624)
  Suppress incorrect warning in nargsort for timezone-aware DatetimeIndex (pandas-dev#25629)
  TST: fix incorrect sparse test (now failing on scipy master) (pandas-dev#25653)
  CLN: Removed debugging code (pandas-dev#25647)
  DOC: require Return section only if return is not None nor commentary (pandas-dev#25008)
  DOC:Remove hard-coded examples from _flex_doc_SERIES (pandas-dev#24589) (pandas-dev#25524)
  TST: xref pandas-dev#25630 (pandas-dev#25643)
  BUG: Fix pandas-dev#25481 by fixing the error message in TypeError (pandas-dev#25540)
  Fixturize tests/frame/test_mutate_columns.py (pandas-dev#25642)
  Fixturize tests/frame/test_join.py (pandas-dev#25639)
  Fixturize tests/frame/test_combine_concat.py (pandas-dev#25634)
  Fixturize tests/frame/test_asof.py (pandas-dev#25628)
  BUG: Fix user-facing AssertionError with to_html (pandas-dev#25608) (pandas-dev#25620)
  DOC: resolve all GL03 docstring validation errors (pandas-dev#25525)
  TST: failing wheel building on PY2 and old numpy (pandas-dev#25631)
  DOC: Remove makePanel from docs (pandas-dev#25609) (pandas-dev#25612)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.