Jon Solow commited on
Commit
71c2c20
·
1 Parent(s): 6e3dcdf

Fix against_all_wins calc

Browse files
Files changed (1) hide show
  1. src/analyze_yahoo.py +1 -1
src/analyze_yahoo.py CHANGED
@@ -17,7 +17,7 @@ def calculate_luck(df: pd.DataFrame, as_of_week: Optional[int] = None, include_c
17
  if len(df_week) != n_teams:
18
  next
19
  else:
20
- df_week["against_all_wins"] = ((df_week.team_points.rank().astype("float") - 1) / n_teams).round(2)
21
  df_week["against_all_losses"] = 1 - df_week["against_all_wins"]
22
  df_week["half_wins"] = (df_week["against_all_wins"] >= 0.5) * 1.0
23
  df_week["half_losses"] = 1 - df_week["half_wins"]
 
17
  if len(df_week) != n_teams:
18
  next
19
  else:
20
+ df_week["against_all_wins"] = ((df_week.team_points.rank().astype("float") - 1) / (n_teams - 1)).round(2)
21
  df_week["against_all_losses"] = 1 - df_week["against_all_wins"]
22
  df_week["half_wins"] = (df_week["against_all_wins"] >= 0.5) * 1.0
23
  df_week["half_losses"] = 1 - df_week["half_wins"]