-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
""" | ||
aggregate benchmark csv file to generate latex table | ||
""" | ||
import argparse | ||
import pandas as pd | ||
|
||
|
||
def gen_latex_table(raw_df, fname="table_perf.tex", | ||
group="method", str_perf="acc"): | ||
""" | ||
aggregate benchmark csv file to generate latex table | ||
""" | ||
df_result = raw_df.groupby(group)[str_perf].agg(["mean", "std"]) | ||
latex_table = df_result.to_latex(float_format="%.3f") | ||
with open(fname, 'w') as file: | ||
file.write(latex_table) | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser(description="Read a CSV file") | ||
parser.add_argument("filename", help="Name of the CSV file to read") | ||
args = parser.parse_args() | ||
|
||
df = pd.read_csv(args.filename, index_col=False, skipinitialspace=True) | ||
gen_latex_table(df) |