Skip to content

Commit

Permalink
BUG: to_html doesn't slice index to max_rows before formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
y-p committed Nov 26, 2013
1 parent 2e4ca43 commit f95a7bf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pandas/core/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,14 +819,14 @@ def _write_body(self, indent):

def _write_regular_rows(self, fmt_values, indent, truncated):
ncols = min(len(self.columns), self.max_cols)

nrows = min(len(self.frame), self.max_rows)
fmt = self.fmt._get_formatter('__index__')
if fmt is not None:
index_values = self.frame.index.map(fmt)
index_values = self.frame.index[:nrows].map(fmt)
else:
index_values = self.frame.index.format()
index_values = self.frame.index[:nrows].format()

for i in range(min(len(self.frame), self.max_rows)):
for i in range(nrows):
row = []
row.append(index_values[i])
row.extend(fmt_values[j][i] for j in range(ncols))
Expand Down

0 comments on commit f95a7bf

Please sign in to comment.