code: def generate_statistics(self):
          
          matches = self._matches
          witness_fields = [constants.WORK_FIELDNAME, constants.SIGLUM_FIELDNAME,
                            constants.LABEL_FIELDNAME]
          witnesses = matches[witness_fields].drop_duplicates()
          rows = []
          for index, (work, siglum, label) in witnesses.iterrows():
              witness = self._corpus.get_witness(work, siglum)
              witness_matches = matches[
                  (matches[constants.WORK_FIELDNAME] == work) &
                  (matches[constants.SIGLUM_FIELDNAME] == siglum)]
              total_count, matching_count = self._process_witness(
                  witness, witness_matches)
              percentage = matching_count / total_count * 100
              rows.append({constants.WORK_FIELDNAME: work,
                           constants.SIGLUM_FIELDNAME: siglum,
                           constants.COUNT_TOKENS_FIELDNAME: matching_count,
                           constants.TOTAL_TOKENS_FIELDNAME: total_count,
                           constants.PERCENTAGE_FIELDNAME: percentage,
                           constants.LABEL_FIELDNAME: label})
          self._stats = pd.DataFrame(
              rows, columns=constants.STATISTICS_FIELDNAMES)
docs: Replaces result rows with summary statistics about the results.
  
          These statistics give the filename, total matching tokens,
          percentage of matching tokens and label for each witness in
          the results.