def write_summary(report_dir, df):
  """Write summary statistics about the examples in df.

  For example, this will output how many of each label there is of each type.

  Args:
    report_dir: Directory to write summary to
    df: Dataframe of examples (claim/evidence pairs) to summarize
  """
  pd.set_option('display.max_colwidth', 300)
  with util.safe_open(report_dir / 'summary.txt', 'w') as f:
    f.write('Counts of examples by Evidence label\n')
    f.write(str(df.groupby('evidence_label').count()))
    f.write('\n')
    f.write('Count of examples by fold/scrape/evidence label/claim label\n')
    f.write(
        str(
            df.groupby(['fold', 'scrape_type', 'evidence_label',
                        'claim_label']).count()))
    f.write('\n')
    f.write('Detailed Count of examples\n')
    f.write(
        str(
            df.groupby([
                'fold', 'scrape_type', 'evidence_label', 'claim_label',
                'retrieved', 'gold', 'tfidf_candidate'
            ]).count()))
Write summary statistics about the examples in df.

  For example, this will output how many of each label there is of each type.

  Args:
    report_dir: Directory to write summary to
    df: Dataframe of examples (claim/evidence pairs) to summarize
  
language/serene/analysis.py