James McCool commited on
Commit
61dd8c5
·
1 Parent(s): 43f4453

Refactor captain ownership calculation in app.py to simplify logic by removing unnecessary type variable check, ensuring accurate ownership adjustments when captain ownership data is missing.

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -175,12 +175,11 @@ with tab1:
175
  pass
176
  projections['salary'] = projections['salary'].dropna().astype(int)
177
  projections['ownership'] = projections['ownership'].astype(float)
178
- if type_var == 'Showdown':
179
- if projections['captain ownership'].isna().all():
180
- projections['CPT_Own_raw'] = (projections['ownership'] / 2) * ((100 - (100-projections['ownership']))/100)
181
- cpt_own_var = 100 / projections['CPT_Own_raw'].sum()
182
- projections['captain ownership'] = projections['CPT_Own_raw'] * cpt_own_var
183
- projections = projections.drop(columns='CPT_Own_raw', axis=1)
184
 
185
  projections = projections.apply(lambda x: x.replace(player_wrong_names_mlb, player_right_names_mlb))
186
  st.dataframe(projections.head(10))
 
175
  pass
176
  projections['salary'] = projections['salary'].dropna().astype(int)
177
  projections['ownership'] = projections['ownership'].astype(float)
178
+ if projections['captain ownership'].isna().all():
179
+ projections['CPT_Own_raw'] = (projections['ownership'] / 2) * ((100 - (100-projections['ownership']))/100)
180
+ cpt_own_var = 100 / projections['CPT_Own_raw'].sum()
181
+ projections['captain ownership'] = projections['CPT_Own_raw'] * cpt_own_var
182
+ projections = projections.drop(columns='CPT_Own_raw', axis=1)
 
183
 
184
  projections = projections.apply(lambda x: x.replace(player_wrong_names_mlb, player_right_names_mlb))
185
  st.dataframe(projections.head(10))