File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ """
2
+ aggregate benchmark csv file to generate latex table
3
+ """
4
+ import argparse
5
+ import pandas as pd
6
+
7
+
8
+ def gen_latex_table (raw_df , fname = "table_perf.tex" ,
9
+ group = "method" , str_perf = "acc" ):
10
+ """
11
+ aggregate benchmark csv file to generate latex table
12
+ """
13
+ df_result = raw_df .groupby (group )[str_perf ].agg (["mean" , "std" ])
14
+ latex_table = df_result .to_latex (float_format = "%.3f" )
15
+ with open (fname , 'w' ) as file :
16
+ file .write (latex_table )
17
+
18
+
19
+ if __name__ == "__main__" :
20
+ parser = argparse .ArgumentParser (description = "Read a CSV file" )
21
+ parser .add_argument ("filename" , help = "Name of the CSV file to read" )
22
+ args = parser .parse_args ()
23
+
24
+ df = pd .read_csv (args .filename , index_col = False , skipinitialspace = True )
25
+ gen_latex_table (df )
You can’t perform that action at this time.
0 commit comments