From 06c9984cc9c5c9c5ca2924b0d1d3c0921af5ff69 Mon Sep 17 00:00:00 2001 From: cdolfi Date: Fri, 5 Apr 2024 13:51:18 -0400 Subject: [PATCH] log 0 error handling --- 8Knot/pages/chaoss/visualizations/project_velocity.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/8Knot/pages/chaoss/visualizations/project_velocity.py b/8Knot/pages/chaoss/visualizations/project_velocity.py index 3740c1ab..5b21efa8 100644 --- a/8Knot/pages/chaoss/visualizations/project_velocity.py +++ b/8Knot/pages/chaoss/visualizations/project_velocity.py @@ -331,9 +331,11 @@ def process_data( # replace all nan to 0 df_consolidated.fillna(value=0, inplace=True) - # log of commits and contribs - df_consolidated["log_num_commits"] = df_consolidated["Commit"].apply(math.log) - df_consolidated["log_num_contrib"] = df_consolidated["num_unique_contributors"].apply(math.log) + # log of commits and contribs if values are not 0 + df_consolidated["log_num_commits"] = df_consolidated["Commit"].apply(lambda x: math.log(x) if x != 0 else 0) + df_consolidated["log_num_contrib"] = df_consolidated["num_unique_contributors"].apply( + lambda x: math.log(x) if x != 0 else 0 + ) # column to hold the weighted values of pr and issues actions summed together df_consolidated["prs_issues_actions_weighted"] = (