Skip to content

Commit

Permalink
BUG: fix for bug 16493
Browse files Browse the repository at this point in the history
  • Loading branch information
CRP committed May 25, 2017
1 parent a40820d commit 426565e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.20.2.txt
Expand Up @@ -59,6 +59,7 @@ I/O
- Bug in pd.read_csv() when comment is passed in space deliminted text files (:issue:`16472`)
- Bug that would force importing of the clipboard routines unnecessarily, potentially causing an import error on startup (:issue:`16288`)
- Bug that raised IndexError HTML-rendering an empty DataFrame (:issue:`15953`)
- Bug where to_html ignored the index_names parameter (:issue:`16493`)


Plotting
Expand Down
2 changes: 1 addition & 1 deletion pandas/io/formats/format.py
Expand Up @@ -1292,7 +1292,7 @@ def _column_header():
self.write_tr(col_row, indent, self.indent_delta, header=True,
align=align)

if self.fmt.has_index_names and self.fmt.index and self.show_index_names:
if self.fmt.has_index_names and self.fmt.index and self.fmt.show_index_names:
row = ([x if x is not None else ''
for x in self.frame.index.names] +
[''] * min(len(self.columns), self.max_cols))
Expand Down
5 changes: 5 additions & 0 deletions pandas/tests/io/formats/test_to_html.py
Expand Up @@ -1869,3 +1869,8 @@ def test_to_html_notebook_has_no_style(self):
df = pd.DataFrame({"A": [1, 2, 3]})
result = df.to_html()
assert "thead tr:only-child" not in result

def test_to_html_with_index_names_false(self):
df = pd.DataFrame({"A": [1, 2], index=pd.Index(['a', 'b'], name='myindexname'})
result = df.to_html(index_names=False)
assert 'myindexname' not in result

0 comments on commit 426565e

Please sign in to comment.