Spaces:
Sleeping
Sleeping
James McCool commited on
Commit ·
76fcc95
1
Parent(s): 76eaa36
Refactor VORP roster assignment in Streamlit app to utilize combined position and rank for mapping halfPPR and custom match dictionaries, enhancing accuracy in player evaluations.
Browse files- src/streamlit_app.py +3 -4
src/streamlit_app.py
CHANGED
|
@@ -395,8 +395,9 @@ def assign_vorp_roster(frame: pd.DataFrame, halfPpr_rv: dict, custom_rv: dict, p
|
|
| 395 |
pos_frame = frame[frame['Pos'] == positions]
|
| 396 |
pos_frame = pos_frame[pos_frame['Rank'] != 0]
|
| 397 |
pos_frame = pos_frame.sort_values(by='Rank', ascending=True).reset_index(drop=True)
|
| 398 |
-
|
| 399 |
-
|
|
|
|
| 400 |
|
| 401 |
pos_frame['halfPpr_rv'] = halfPpr_rv[positions]
|
| 402 |
pos_frame['custom_rv'] = custom_rv[positions]
|
|
@@ -440,8 +441,6 @@ def main():
|
|
| 440 |
|
| 441 |
# Calculate VORP and rankings
|
| 442 |
pos_des_dict, orig_rank_dict, half_ppr_match_dict, custom_match_dict = assign_vorp_scoring(position_df, halfPpr_rv, custom_scoring_rv, user_league_settings, user_pos_vorp_limiters)
|
| 443 |
-
print(half_ppr_match_dict)
|
| 444 |
-
print(custom_match_dict)
|
| 445 |
final_df = assign_vorp_roster(position_df, halfPpr_rv, custom_roster_rv, user_pos_vorp_limiters, half_ppr_match_dict, custom_match_dict)
|
| 446 |
final_df = final_df.drop(columns=['SR_ID'], axis=1)
|
| 447 |
final_df['Name_Lookup'] = final_df['Name'].map(orig_rank_dict)
|
|
|
|
| 395 |
pos_frame = frame[frame['Pos'] == positions]
|
| 396 |
pos_frame = pos_frame[pos_frame['Rank'] != 0]
|
| 397 |
pos_frame = pos_frame.sort_values(by='Rank', ascending=True).reset_index(drop=True)
|
| 398 |
+
pos_frame['pos_rank_initial'] = pos_frame['Pos'] + pos_frame['Rank'].astype(str)
|
| 399 |
+
halfPpr_rv_var = pos_frame['pos_rank_initial'].map(half_ppr_match_dict)
|
| 400 |
+
custom_rv_var = pos_frame['pos_rank_initial'].map(custom_match_dict)
|
| 401 |
|
| 402 |
pos_frame['halfPpr_rv'] = halfPpr_rv[positions]
|
| 403 |
pos_frame['custom_rv'] = custom_rv[positions]
|
|
|
|
| 441 |
|
| 442 |
# Calculate VORP and rankings
|
| 443 |
pos_des_dict, orig_rank_dict, half_ppr_match_dict, custom_match_dict = assign_vorp_scoring(position_df, halfPpr_rv, custom_scoring_rv, user_league_settings, user_pos_vorp_limiters)
|
|
|
|
|
|
|
| 444 |
final_df = assign_vorp_roster(position_df, halfPpr_rv, custom_roster_rv, user_pos_vorp_limiters, half_ppr_match_dict, custom_match_dict)
|
| 445 |
final_df = final_df.drop(columns=['SR_ID'], axis=1)
|
| 446 |
final_df['Name_Lookup'] = final_df['Name'].map(orig_rank_dict)
|