code: def sum_excel(in_csv, out_xlsx):
      # read csv with two headers then convert it to xlsx,
      # get total number of train&valid images and mean of results
      df = pd.read_csv(in_csv)
      df.insert(2, "dataset", pd.Series([]))
      df = df.iloc[:, 1:]
      average = df.iloc[1:].groupby(
          "Category"
      )  # group by category name
      df_new = df.iloc[0:1, :]
      num = 0
      for key, value in average:
          num += 1
          df_cate = [key]
          for i in range(1, 10):
              if i == 1:
                  df_cate.append(len(value))
              elif i != 1 and i < 5:
                  df_cate.append(value.iloc[:, i].astype(float).sum())
              else:
                  # import pdb; pdb.set_trace()
                  df_cate.append(
                      format(
                          value.iloc[:, i]
                          .astype(float)
                          .replace("", np.nan)
                          .replace(-1.0000, np.nan)
                          .mean(),
                          ".4f",
                      )
                  )
  
          # import pdb;pdb.set_trace()
          df_new.loc[len(df_new)] = df_cate
  
      df_cate = ["total"]  # final row = 'total'
      for i in range(1, 10):
          if i < 5:
              df_cate.append(df_new.iloc[1:, i].astype(float).sum())
          else:
              df_cate.append(
                  format(
                      df_new.iloc[1:, i]
                      .astype(float)
                      .replace("", np.nan)
                      .mean(),
                      ".4f",
                  )
              )
      df_new.loc[len(df_new) + 1] = df_cate
      df_new.to_excel(out_xlsx, float_format="%.4f", index=False)
  
file_path: mmdetection/projects/RF100-Benchmark/scripts/log_extract.py
imports: import argparse
  import csv
  import json
  import os
  import re
  import numpy
  import pandas
  from openpyxl import load_workbook
  from openpyxl.styles import Alignment
label_desc: Use image node_id 5 for calling a global function with example usage: sum_excel(in_csv, out_xlsx) without return types