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 · Fixed by #25620
Closed
Labels
Error Reporting Incorrect or improved errors from pandas good first issue IO HTML read_html, to_html, Styler.apply, Styler.applymap
Milestone

Comments

@simonjayhawkins
Copy link
Member

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]

@mroeschke mroeschke added Error Reporting Incorrect or improved errors from pandas IO HTML read_html, to_html, Styler.apply, Styler.applymap labels Mar 8, 2019
@simonjayhawkins
Copy link
Member Author

@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
Copy link
Member

Thanks for the suggestion!

@ArtificialQualia
Copy link
Contributor

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
thoo added a commit to thoo/pandas that referenced this issue Mar 11, 2019
* 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
Labels
Error Reporting Incorrect or improved errors from pandas good first issue IO HTML read_html, to_html, Styler.apply, Styler.applymap
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants