Skip to content

Commit b570153

Browse files
committed
ENH: wrap _repr_html in a scrollable div, switch over to info for large frame
1 parent e2fb755 commit b570153

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pandas/core/frame.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,14 @@ def __repr__(self):
463463
return com.console_encode(buf.getvalue())
464464

465465
def _repr_html_(self):
466-
return self.to_html()
466+
if len(self.index) <= 1000 and len(self.columns)<= 20:
467+
return ('<div style="max-height:1000px;'
468+
'max-width:1500px;overflow:auto;">' +
469+
self.to_html() + '</div>')
470+
else:
471+
buf = StringIO()
472+
self.info(buf=buf, verbose=self._verbose_info)
473+
return '<pre>' + com.console_encode(buf.getvalue()) + '</pre>'
467474

468475
def __iter__(self):
469476
"""

0 commit comments

Comments
 (0)