code: def as_html(self, max_rows=0):
          
          if not max_rows or max_rows > self.num_rows:
              max_rows = self.num_rows
          omitted = max(0, self.num_rows - max_rows)
          labels = self.labels
          lines = [
              (0, '<table border="1" class="dataframe">'),
              (1, '<thead>'),
              (2, '<tr>'),
              (3, ' '.join('<th>' + label + '</th>' for label in labels)),
              (2, '</tr>'),
              (1, '</thead>'),
              (1, '<tbody>'),
          ]
          fmts = self._get_column_formatters(max_rows, True)
          for row in itertools.islice(self.rows, max_rows):
              lines += [
                  (2, '<tr>'),
                  (3, ' '.join('<td>' + fmt(v, label=False) + '</td>' for
                      v, fmt in zip(row, fmts))),
                  (2, '</tr>'),
              ]
          lines.append((1, '</tbody>'))
          lines.append((0, '</table>'))
          if omitted:
              lines.append((0, '<p>... ({} rows omitted)</p>'.format(omitted)))
          return '\n'.join(4 * indent * ' ' + text for indent, text in lines)
docs: Format table as HTML.