code: def append_index(self, num_rows):
          
          width = len(str(num_rows - 1))
  
          def f(datum):
              return str(datum.idx).ljust(width)
          header = ' '*width
  
          self.append(header, f)
docs: Add an index column.
  
          Left justified, width is determined by the space needed to print the
          largest index.