James McCool
commited on
Commit
·
26e1ce5
1
Parent(s):
d918500
Remove debug print statements from app.py and exposure_spread.py to clean up code and improve performance during exposure evaluations.
Browse files- app.py +0 -2
- global_func/exposure_spread.py +0 -12
app.py
CHANGED
|
@@ -1345,8 +1345,6 @@ with tab2:
|
|
| 1345 |
exp_submitted = st.form_submit_button("Export")
|
| 1346 |
if reg_submitted:
|
| 1347 |
st.session_state['settings_base'] = False
|
| 1348 |
-
print(exposure_player)
|
| 1349 |
-
print(st.session_state['exposure_player'])
|
| 1350 |
parsed_frame = exposure_spread(st.session_state['working_frame'], st.session_state['exposure_player'], exposure_target, exposure_stack_bool, remove_teams_exposure, st.session_state['projections_df'], sport_var, type_var, salary_max)
|
| 1351 |
|
| 1352 |
if type_var == 'Classic':
|
|
|
|
| 1345 |
exp_submitted = st.form_submit_button("Export")
|
| 1346 |
if reg_submitted:
|
| 1347 |
st.session_state['settings_base'] = False
|
|
|
|
|
|
|
| 1348 |
parsed_frame = exposure_spread(st.session_state['working_frame'], st.session_state['exposure_player'], exposure_target, exposure_stack_bool, remove_teams_exposure, st.session_state['projections_df'], sport_var, type_var, salary_max)
|
| 1349 |
|
| 1350 |
if type_var == 'Classic':
|
global_func/exposure_spread.py
CHANGED
|
@@ -218,7 +218,6 @@ def check_position_eligibility(sport, column_name, player_positions):
|
|
| 218 |
return column_name in player_positions
|
| 219 |
|
| 220 |
def exposure_spread(working_frame, exposure_player, exposure_target, exposure_stack_bool, remove_teams, projections_df, sport_var, type_var, salary_max):
|
| 221 |
-
print(exposure_player)
|
| 222 |
comparable_players = projections_df[projections_df['player_names'] == exposure_player]
|
| 223 |
|
| 224 |
comparable_players = comparable_players.reset_index(drop=True)
|
|
@@ -261,12 +260,6 @@ def exposure_spread(working_frame, exposure_player, exposure_target, exposure_st
|
|
| 261 |
else:
|
| 262 |
lineups_to_remove = ((player_exposure - exposure_target) * len(working_frame)) * 1.01
|
| 263 |
lineups_to_add = ((exposure_target - player_exposure) * (len(working_frame) - (player_exposure * len(working_frame)))) * 1.10
|
| 264 |
-
print(player_exposure)
|
| 265 |
-
print(exposure_target)
|
| 266 |
-
print(lineups_to_remove)
|
| 267 |
-
print(exposure_target - player_exposure)
|
| 268 |
-
print(exposure_target)
|
| 269 |
-
print(lineups_to_add)
|
| 270 |
|
| 271 |
# isolate the rows that contain the player
|
| 272 |
player_rows = working_frame[player_mask]
|
|
@@ -351,18 +344,13 @@ def exposure_spread(working_frame, exposure_player, exposure_target, exposure_st
|
|
| 351 |
comparable_players = comparable_players[comparable_players['player_names'] != exposure_player]
|
| 352 |
|
| 353 |
# Create a list of comparable players
|
| 354 |
-
print(lineups_to_add)
|
| 355 |
-
print(lineups_to_add - change_counter)
|
| 356 |
comparable_player_list = comparable_players['player_names'].tolist()
|
| 357 |
-
print(comparable_player_list)
|
| 358 |
if comparable_player_list:
|
| 359 |
# Find which column contains the exposure_player
|
| 360 |
row_data = working_frame.iloc[row]
|
| 361 |
for col in working_frame.columns:
|
| 362 |
if row_data[col] in comparable_player_list:
|
| 363 |
-
print(working_frame.iloc[row]['salary'] - projections_df[projections_df['player_names'] == row_data[col]]['salary'].iloc[0] + projections_df[projections_df['player_names'] == exposure_player]['salary'].iloc[0])
|
| 364 |
if working_frame.iloc[row]['salary'] - projections_df[projections_df['player_names'] == row_data[col]]['salary'].iloc[0] + projections_df[projections_df['player_names'] == exposure_player]['salary'].iloc[0] <= salary_max:
|
| 365 |
-
print(row_data[col])
|
| 366 |
# Get the replacement player's positions
|
| 367 |
replacement_player_positions = projections_df[projections_df['player_names'] == row_data[col]]['position'].iloc[0].split('/')
|
| 368 |
|
|
|
|
| 218 |
return column_name in player_positions
|
| 219 |
|
| 220 |
def exposure_spread(working_frame, exposure_player, exposure_target, exposure_stack_bool, remove_teams, projections_df, sport_var, type_var, salary_max):
|
|
|
|
| 221 |
comparable_players = projections_df[projections_df['player_names'] == exposure_player]
|
| 222 |
|
| 223 |
comparable_players = comparable_players.reset_index(drop=True)
|
|
|
|
| 260 |
else:
|
| 261 |
lineups_to_remove = ((player_exposure - exposure_target) * len(working_frame)) * 1.01
|
| 262 |
lineups_to_add = ((exposure_target - player_exposure) * (len(working_frame) - (player_exposure * len(working_frame)))) * 1.10
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
|
| 264 |
# isolate the rows that contain the player
|
| 265 |
player_rows = working_frame[player_mask]
|
|
|
|
| 344 |
comparable_players = comparable_players[comparable_players['player_names'] != exposure_player]
|
| 345 |
|
| 346 |
# Create a list of comparable players
|
|
|
|
|
|
|
| 347 |
comparable_player_list = comparable_players['player_names'].tolist()
|
|
|
|
| 348 |
if comparable_player_list:
|
| 349 |
# Find which column contains the exposure_player
|
| 350 |
row_data = working_frame.iloc[row]
|
| 351 |
for col in working_frame.columns:
|
| 352 |
if row_data[col] in comparable_player_list:
|
|
|
|
| 353 |
if working_frame.iloc[row]['salary'] - projections_df[projections_df['player_names'] == row_data[col]]['salary'].iloc[0] + projections_df[projections_df['player_names'] == exposure_player]['salary'].iloc[0] <= salary_max:
|
|
|
|
| 354 |
# Get the replacement player's positions
|
| 355 |
replacement_player_positions = projections_df[projections_df['player_names'] == row_data[col]]['position'].iloc[0].split('/')
|
| 356 |
|