James McCool
commited on
Commit
·
b849f0e
1
Parent(s):
63731a1
Refactor app.py to conditionally calculate 'CPT_Salary' and 'flex_proj' salaries based on sport selection (NBA or NFL). This update enhances the accuracy of player projections by applying different salary multipliers for each sport, improving the overall functionality of the application.
Browse files
app.py
CHANGED
@@ -229,7 +229,10 @@ with tab2:
|
|
229 |
ownframe['Own'] = ownframe['Cash_Field_Own']
|
230 |
export_baselines = ownframe[['Player', 'Salary', 'Position', 'Team', 'Opp', 'Median', 'Own', 'CPT_Own', 'player_id']]
|
231 |
export_baselines['CPT_Proj'] = export_baselines['Median'] * 1.5
|
232 |
-
|
|
|
|
|
|
|
233 |
export_baselines['ID'] = export_baselines['player_id']
|
234 |
display_baselines = ownframe[['Player', 'Salary', 'Position', 'Team', 'Opp', 'Median', 'Own', 'CPT_Own']]
|
235 |
display_baselines = display_baselines.sort_values(by='Median', ascending=False)
|
@@ -245,7 +248,10 @@ with tab2:
|
|
245 |
|
246 |
if site_var1 == 'Draftkings':
|
247 |
cpt_proj['Player'] = display_baselines['Player']
|
248 |
-
|
|
|
|
|
|
|
249 |
cpt_proj['Position'] = display_baselines['Position']
|
250 |
cpt_proj['Team'] = display_baselines['Team']
|
251 |
cpt_proj['Opp'] = display_baselines['Opp']
|
@@ -259,7 +265,10 @@ with tab2:
|
|
259 |
cpt_proj = cpt_proj[~cpt_proj['Player'].isin(lock_var2)]
|
260 |
|
261 |
flex_proj['Player'] = display_baselines['Player']
|
262 |
-
|
|
|
|
|
|
|
263 |
flex_proj['Position'] = display_baselines['Position']
|
264 |
flex_proj['Team'] = display_baselines['Team']
|
265 |
flex_proj['Opp'] = display_baselines['Opp']
|
|
|
229 |
ownframe['Own'] = ownframe['Cash_Field_Own']
|
230 |
export_baselines = ownframe[['Player', 'Salary', 'Position', 'Team', 'Opp', 'Median', 'Own', 'CPT_Own', 'player_id']]
|
231 |
export_baselines['CPT_Proj'] = export_baselines['Median'] * 1.5
|
232 |
+
if sport_var1 == 'NBA':
|
233 |
+
export_baselines['CPT_Salary'] = export_baselines['Salary'] * 1.5
|
234 |
+
elif sport_var1 == 'NFL':
|
235 |
+
export_baselines['CPT_Salary'] = export_baselines['Salary']
|
236 |
export_baselines['ID'] = export_baselines['player_id']
|
237 |
display_baselines = ownframe[['Player', 'Salary', 'Position', 'Team', 'Opp', 'Median', 'Own', 'CPT_Own']]
|
238 |
display_baselines = display_baselines.sort_values(by='Median', ascending=False)
|
|
|
248 |
|
249 |
if site_var1 == 'Draftkings':
|
250 |
cpt_proj['Player'] = display_baselines['Player']
|
251 |
+
if sport_var1 == 'NBA':
|
252 |
+
cpt_proj['Salary'] = display_baselines['Salary'] * 1.5
|
253 |
+
elif sport_var1 == 'NFL':
|
254 |
+
cpt_proj['Salary'] = display_baselines['Salary']
|
255 |
cpt_proj['Position'] = display_baselines['Position']
|
256 |
cpt_proj['Team'] = display_baselines['Team']
|
257 |
cpt_proj['Opp'] = display_baselines['Opp']
|
|
|
265 |
cpt_proj = cpt_proj[~cpt_proj['Player'].isin(lock_var2)]
|
266 |
|
267 |
flex_proj['Player'] = display_baselines['Player']
|
268 |
+
if sport_var1 == 'NBA':
|
269 |
+
flex_proj['Salary'] = display_baselines['Salary']
|
270 |
+
elif sport_var1 == 'NFL':
|
271 |
+
flex_proj['Salary'] = display_baselines['Salary'] / 1.5
|
272 |
flex_proj['Position'] = display_baselines['Position']
|
273 |
flex_proj['Team'] = display_baselines['Team']
|
274 |
flex_proj['Opp'] = display_baselines['Opp']
|