fix: use max() for pitcher OPS split weighting (#6) #60
@ -616,8 +616,9 @@ def sort_pitchers(pitching_card_query) -> DataFrame | None:
|
||||
return float("inf")
|
||||
ops_vl = vlval.obp + vlval.slg
|
||||
ops_vr = vrval.obp + vrval.slg
|
||||
# TODO: should this be max??
|
||||
return (ops_vr + ops_vl + min(ops_vl, ops_vr)) / 3
|
||||
# Weight the weaker split (higher OPS allowed) so platoon weaknesses are penalized.
|
||||
# Starters face both LHH and RHH, so vulnerability against either hand matters.
|
||||
return (ops_vr + ops_vl + max(ops_vl, ops_vr)) / 3
|
||||
|
||||
pitcher_df["total_ops"] = pitcher_df.apply(get_total_ops, axis=1)
|
||||
return pitcher_df.sort_values(by="total_ops")
|
||||
@ -698,7 +699,8 @@ async def get_team_sp(
|
||||
return float("inf")
|
||||
ops_vl = vlval.obp + vlval.slg
|
||||
ops_vr = vrval.obp + vrval.slg
|
||||
return (ops_vr + ops_vl + min(ops_vl, ops_vr)) / 3
|
||||
# Weight the weaker split (higher OPS allowed) so platoon weaknesses are penalized.
|
||||
return (ops_vr + ops_vl + max(ops_vl, ops_vr)) / 3
|
||||
|
||||
starter_df["total_ops"] = starter_df.apply(get_total_ops, axis=1)
|
||||
return starter_df.sort_values(by="total_ops")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user