def final_latex_table()

in parse.py [0:0]


def final_latex_table(final_df, df, do_anova, col_to_show):
    template_begining = (
        r"""
    \begin{tabular}{lllccccc}
                \toprule
                \textbf{Method} & \textbf{\#HP} & \textbf{Groups} & \multicolumn{4}{c}{\textbf{Worst Acc}} & \textbf{Average}                                                                                                          \\
                \cmidrule(lr){4-7}
                                &               &                 & CelebA                                 & Waterbirds       & MultiNLI                                       & CivilComments                                  &      \\
                \midrule
    """
    )
    middle = r""
    last_group = None
    df = df.set_index(["dataset", "Method"])
    for _, row in final_df.iterrows():
        for dataset in ["CelebA", "Waterbirds", "MultiNLI", "CivilComments"]:
            if do_anova:
                if df.loc[(dataset, row["Method"])]["Signif Diff"].item():
                    row[dataset] = "\cellcolor{blue!7}" + str(
                        row[dataset]
                    )
        if row["Groups"] != last_group and last_group is not None:
            middle += "\\midrule \n"
        middle += r" & ".join(row.astype(str).values)
        middle += "\\\\ \n"
        last_group = row["Groups"]

    template_ending = r"""
    \bottomrule \\
    \end{tabular}
    """
    return template_begining + middle + template_ending