code: def write_every_dataset_final_summary_table_tex(
      summaries_by_dataset: Dict[str, pandas.DataFrame],
      out_dir: str,
  ):
      summary_all_datasets = pandas.concat(
          [
              df.rename(columns={"MAX": name})
              for name, df in summaries_by_dataset.items()
              if df is not None
          ],
          axis=1,
      )
      formatted_summary = summary_all_datasets[
          DATASET_COLUMN_ORDER
      ].rename(index=LATEX_ROW_MAPPING)
  
      to_format = top_2_format_replacements(formatted_summary)
      formatted_summary = formatted_summary.replace(to_format)
      formatted_summary = formatted_summary.replace(math.nan, "-")
      formatted_summary = formatted_summary.applymap(
          enforce_decimal_places
      )
  
      summary_out_path = os.path.join(out_dir, "summary.tex")
      formatted_summary.to_csv(summary_out_path, **TO_CSV_TEX_KARGS)
      print(f"Summary written to: {summary_out_path}")
  
file_path: ParlAI/projects/roscoe/meta_evaluation/table_file_writing.py
imports: import copy
  import csv
  import math
  import os
  import pandas
  from typing import Dict, List, Union
  from projects.roscoe.score import FAITHFUL_SENT, FAITHFUL_WORD, INFORM_STEP, REPETITION_WORD, INFORM_CHAIN, REPETITION_SENT, COHERENCE_STEP_VS_STEP, DISCOURSE_REPRESENTATION, GRAMMAR_STEP, PPL_STEP, PPL_CHAIN
label_desc: Use image node_id 8 for calling a global function with example usage: write_every_dataset_final_summary_table_tex(summaries_by_dataset, out_dir) without return types