Skip to content

Commit e175ea9

Browse files
haydy-p
authored andcommitted
ENH: html repr respects show_dimensions
1 parent e517159 commit e175ea9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

pandas/core/frame.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,11 +486,12 @@ def _repr_html_(self):
486486
if get_option("display.notebook_repr_html"):
487487
max_rows = get_option("display.max_rows")
488488
max_cols = get_option("display.max_columns")
489+
show_dimensions = get_option("display.show_dimensions")
489490

490491
return ('<div style="max-height:1000px;'
491492
'max-width:1500px;overflow:auto;">\n' +
492493
self.to_html(max_rows=max_rows, max_cols=max_cols,
493-
show_dimensions=True) + '\n</div>')
494+
show_dimensions=show_dimensions) + '\n</div>')
494495
else:
495496
return None
496497

pandas/tests/test_format.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,6 +1428,13 @@ def test_repr_html(self):
14281428

14291429
fmt.reset_option('^display.')
14301430

1431+
df = DataFrame([[1, 2], [3, 4]])
1432+
self.assertTrue('2 rows' in df._repr_html_())
1433+
fmt.set_option('display.show_dimensions', False)
1434+
self.assertFalse('2 rows' in df._repr_html_())
1435+
1436+
fmt.reset_option('^display.')
1437+
14311438
def test_repr_html_wide(self):
14321439
row = lambda l, k: [tm.rands(k) for _ in range(l)]
14331440
max_cols = get_option('display.max_columns')

0 commit comments

Comments
 (0)