Skip to content

Commit

Permalink
fix(pdf): return - if metric not found
Browse files Browse the repository at this point in the history
  • Loading branch information
Caceresenzo committed Dec 20, 2023
1 parent 3dac3a3 commit a7f7cea
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backtest/export/pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ def get_metric(column: str, name: str):
except:
pass

if name not in df_metrics.index:
print(f"[warning] invalid metric name: `{name}`: not in index: {df_metrics.index}")
return "-"

value = df_metrics.loc[name, column]
if name in NOT_PERCENT:
return value
Expand Down

0 comments on commit a7f7cea

Please sign in to comment.