tabular display: show 10 rows if index is larger than max_rows

This commit is contained in:
Michael Hirsch 2019-11-15 11:10:35 -05:00
parent 394128acf5
commit b0be68e1db

View File

@ -251,6 +251,7 @@ class DataFrame(NDFrame):
width, _ = console.get_console_size()
else:
width = None
self.to_string(buf=buf, max_rows=max_rows, max_cols=max_cols,
line_width=width, show_dimensions=show_dimensions)
@ -587,6 +588,10 @@ class DataFrame(NDFrame):
"Setting max_rows=60, overwrite if different behaviour is required.")
max_rows = 60
# if the size of the index is larger than max_rows, only show 10 rows
if len(self) > max_rows:
max_rows = 10
# Create a slightly bigger dataframe than display
df = self._build_repr_df(max_rows + 1, max_cols)