Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +17 -4
src/streamlit_app.py
CHANGED
|
@@ -363,13 +363,26 @@ def assign_vorp(frame: pd.DataFrame, halfPpr_rv: dict, custom_rv: dict, league_s
|
|
| 363 |
vorp_frame = pd.DataFrame()
|
| 364 |
for positions in ['QB', 'RB', 'WR', 'TE']:
|
| 365 |
pos_frame = frame[frame['Pos'] == positions]
|
| 366 |
-
pos_frame = pos_frame[pos_frame['Rank'] != 0]
|
| 367 |
-
pos_frame = pos_frame.sort_values(by='Rank', ascending=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 368 |
|
| 369 |
pos_frame['halfPpr_rv'] = halfPpr_rv[positions]
|
| 370 |
pos_frame['custom_rv'] = custom_rv[positions]
|
| 371 |
-
pos_frame['halfPpr_VORP'] = pos_frame['
|
| 372 |
-
pos_frame['custom_VORP'] = pos_frame[
|
| 373 |
|
| 374 |
vorp_frame = pd.concat([vorp_frame, pos_frame]).reset_index(drop=True)
|
| 375 |
|
|
|
|
| 363 |
vorp_frame = pd.DataFrame()
|
| 364 |
for positions in ['QB', 'RB', 'WR', 'TE']:
|
| 365 |
pos_frame = frame[frame['Pos'] == positions]
|
| 366 |
+
pos_frame = pos_frame[pos_frame['Rank'] != 0]
|
| 367 |
+
pos_frame = pos_frame.sort_values(by='Rank', ascending=True).reset_index(drop=True)
|
| 368 |
+
pos_frame['custom_rank_raw'] = pos_frame[rv_type].rank(method='first', ascending=False)
|
| 369 |
+
pos_frame['custom_calc'] = ((pos_frame['custom_rank_raw'] + pos_frame['Rank']) / 2).astype(int)
|
| 370 |
+
pos_frame['custom_proj_rank'] = pos_frame['custom_calc'].rank(method='first', ascending=True)
|
| 371 |
+
|
| 372 |
+
pos_frame['max_halfPpr'] = pos_frame['halfPpr'].max()
|
| 373 |
+
pos_frame['halfPpr_range'] = (pos_frame['max_halfPpr']) / len(pos_frame)
|
| 374 |
+
pos_frame['adj_halfPpr'] = pos_frame['halfPpr_range'] * (len(pos_frame) - (pos_frame.index))
|
| 375 |
+
|
| 376 |
+
pos_frame['max_custom'] = pos_frame[rv_type].max()
|
| 377 |
+
pos_frame['custom_range'] = (pos_frame['max_custom']) / len(pos_frame)
|
| 378 |
+
pos_frame['adj_custom'] = pos_frame['custom_range'] * (len(pos_frame) - (pos_frame['custom_proj_rank'] - 1))
|
| 379 |
+
|
| 380 |
+
print(pos_frame[['Name', 'Rank', 'custom_proj_rank', 'halfPpr', rv_type, 'adj_halfPpr', 'adj_custom']].head(20))
|
| 381 |
|
| 382 |
pos_frame['halfPpr_rv'] = halfPpr_rv[positions]
|
| 383 |
pos_frame['custom_rv'] = custom_rv[positions]
|
| 384 |
+
pos_frame['halfPpr_VORP'] = pos_frame['adj_halfPpr'] - halfPpr_rv[positions]
|
| 385 |
+
pos_frame['custom_VORP'] = pos_frame['adj_custom'] - custom_rv[positions]
|
| 386 |
|
| 387 |
vorp_frame = pd.concat([vorp_frame, pos_frame]).reset_index(drop=True)
|
| 388 |
|