Spaces:
Running
Running
James McCool
commited on
Commit
·
e8f9f9f
1
Parent(s):
abc57c8
Refactor VORP roster assignment in Streamlit app by removing position lock dictionaries from the return values, simplifying the output structure and enhancing clarity in player evaluations.
Browse files- src/streamlit_app.py +2 -5
src/streamlit_app.py
CHANGED
@@ -415,13 +415,11 @@ def assign_vorp_roster(frame: pd.DataFrame, halfPpr_rv: dict, custom_rv: dict, l
|
|
415 |
vorp_frame['vorp_diff'] = np.where(vorp_frame['halfPpr_VORP'] == vorp_frame['custom_VORP'], 0, vorp_frame['halfPpr_vorp_rank'] - vorp_frame['custom_vorp_rank'])
|
416 |
for positions in ['QB', 'RB', 'WR', 'TE']:
|
417 |
vorp_frame.loc[vorp_frame['Pos'] == positions, 'Rank_Adjust'] = (vorp_frame['Rank'] - (vorp_frame['vorp_diff'] * pos_vorp_limiters[positions])).astype(float)
|
418 |
-
pos_lock_dict = dict(zip(vorp_frame['pos_lock'], vorp_frame['Name']))
|
419 |
-
name_lock_dict = dict(zip(vorp_frame['Name'], vorp_frame['pos_lock']))
|
420 |
vorp_frame['custom_rank'] = vorp_frame['Rank_Adjust'].rank(method='first', ascending=True).astype(int)
|
421 |
vorp_frame['pos_rank'] = vorp_frame.groupby('Pos')['custom_rank'].rank(method='first', ascending=True).astype(int)
|
422 |
vorp_frame['pos_designation'] = vorp_frame['Pos'] + vorp_frame['pos_rank'].astype(str)
|
423 |
|
424 |
-
return vorp_frame.sort_values(by='custom_rank', ascending=True)
|
425 |
|
426 |
def main():
|
427 |
st.title("Fantasy Football VORP Calculator")
|
@@ -448,8 +446,7 @@ def main():
|
|
448 |
# Calculate VORP and rankings
|
449 |
pos_des_dict = assign_vorp_scoring(position_df, halfPpr_rv, custom_scoring_rv, user_league_settings, user_pos_vorp_limiters)
|
450 |
final_df = assign_vorp_roster(position_df, halfPpr_rv, custom_roster_rv, user_league_settings, user_pos_vorp_limiters)
|
451 |
-
final_df
|
452 |
-
final_df['orig_rank'] = final_df['Name'].map(name_lock_dict)
|
453 |
final_df['pos_lock_name'] = final_df['pos_designation'].map(pos_des_dict)
|
454 |
|
455 |
# Display results
|
|
|
415 |
vorp_frame['vorp_diff'] = np.where(vorp_frame['halfPpr_VORP'] == vorp_frame['custom_VORP'], 0, vorp_frame['halfPpr_vorp_rank'] - vorp_frame['custom_vorp_rank'])
|
416 |
for positions in ['QB', 'RB', 'WR', 'TE']:
|
417 |
vorp_frame.loc[vorp_frame['Pos'] == positions, 'Rank_Adjust'] = (vorp_frame['Rank'] - (vorp_frame['vorp_diff'] * pos_vorp_limiters[positions])).astype(float)
|
|
|
|
|
418 |
vorp_frame['custom_rank'] = vorp_frame['Rank_Adjust'].rank(method='first', ascending=True).astype(int)
|
419 |
vorp_frame['pos_rank'] = vorp_frame.groupby('Pos')['custom_rank'].rank(method='first', ascending=True).astype(int)
|
420 |
vorp_frame['pos_designation'] = vorp_frame['Pos'] + vorp_frame['pos_rank'].astype(str)
|
421 |
|
422 |
+
return vorp_frame.sort_values(by='custom_rank', ascending=True)
|
423 |
|
424 |
def main():
|
425 |
st.title("Fantasy Football VORP Calculator")
|
|
|
446 |
# Calculate VORP and rankings
|
447 |
pos_des_dict = assign_vorp_scoring(position_df, halfPpr_rv, custom_scoring_rv, user_league_settings, user_pos_vorp_limiters)
|
448 |
final_df = assign_vorp_roster(position_df, halfPpr_rv, custom_roster_rv, user_league_settings, user_pos_vorp_limiters)
|
449 |
+
final_df = final_df.drop(columns=['SR_ID'], axis=1)
|
|
|
450 |
final_df['pos_lock_name'] = final_df['pos_designation'].map(pos_des_dict)
|
451 |
|
452 |
# Display results
|