Skip to content

Commit

Permalink
log 0 error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
cdolfi authored and JamesKunstle committed Apr 10, 2024
1 parent c34915c commit e084d91
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions 8Knot/pages/chaoss/visualizations/project_velocity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"] = (
Expand Down

0 comments on commit e084d91

Please sign in to comment.