Skip to content

Commit 51c26d1

Browse files
committed
latex table in scirpt
1 parent 747476c commit 51c26d1

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

scripts/generate_latex_table.py

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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)

0 commit comments

Comments
 (0)