Skip to content

Commit

Permalink
convert multi-index cols to flat index
Browse files Browse the repository at this point in the history
  • Loading branch information
naga-karthik committed Jun 11, 2024
1 parent 0dd51ec commit 06f66b0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions compute_metrics_reloaded.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ def main():
df_mean = (df.drop(columns=['reference', 'prediction', 'EmptyRef', 'EmptyPred']).groupby('label').
agg(['mean', 'std']).reset_index())

# Convert multi-index to flat index
df_mean.columns = ['_'.join(col).strip() for col in df_mean.columns.values]
# Rename column `label_` back to `label`
df_mean.rename(columns={'label_': 'label'}, inplace=True)

# Rename columns
df.rename(columns={metric: METRICS_TO_NAME[metric] for metric in METRICS_TO_NAME}, inplace=True)
df_mean.rename(columns={metric: METRICS_TO_NAME[metric] for metric in METRICS_TO_NAME}, inplace=True)
Expand Down

0 comments on commit 06f66b0

Please sign in to comment.