James McCool
commited on
Commit
·
0b97fc2
1
Parent(s):
3597da4
Update salary calculation logic in app.py
Browse files- Refactored the salary calculation to utilize 'salary_dict' instead of 'salary_map', ensuring accurate data retrieval for player salaries.
- This change enhances the consistency of data processing across different sports, particularly for GOLF, by standardizing the method of accessing salary information.
app.py
CHANGED
@@ -181,7 +181,7 @@ with tab2:
|
|
181 |
).most_common(1)[0][1] if any(st.session_state['map_dict']['team_map'].get(player, '') for player in row[st.session_state['player_columns']]) else '',
|
182 |
axis=1
|
183 |
)
|
184 |
-
working_df['salary'] = working_df.apply(lambda row: sum(st.session_state['
|
185 |
working_df['actual_fpts'] = working_df.apply(lambda row: sum(st.session_state['actual_dict'].get(player, 0) for player in row[st.session_state['player_columns']]), axis=1)
|
186 |
working_df['actual_own'] = working_df.apply(lambda row: sum(st.session_state['ownership_dict'].get(player, 0) for player in row[st.session_state['player_columns']]), axis=1)
|
187 |
working_df['sorted'] = working_df[st.session_state['player_columns']].apply(
|
@@ -223,7 +223,7 @@ with tab2:
|
|
223 |
axis=1
|
224 |
)
|
225 |
if sport_select == 'GOLF':
|
226 |
-
working_df['salary'] = working_df.apply(lambda row: sum(st.session_state['
|
227 |
working_df['actual_fpts'] = working_df.apply(lambda row: sum(st.session_state['actual_dict'].get(player, 0) for player in row), axis=1)
|
228 |
else:
|
229 |
# Modified salary calculation with 1.5x multiplier for first player
|
|
|
181 |
).most_common(1)[0][1] if any(st.session_state['map_dict']['team_map'].get(player, '') for player in row[st.session_state['player_columns']]) else '',
|
182 |
axis=1
|
183 |
)
|
184 |
+
working_df['salary'] = working_df.apply(lambda row: sum(st.session_state['salary_dict'].get(player, 0) for player in row[st.session_state['player_columns']]), axis=1)
|
185 |
working_df['actual_fpts'] = working_df.apply(lambda row: sum(st.session_state['actual_dict'].get(player, 0) for player in row[st.session_state['player_columns']]), axis=1)
|
186 |
working_df['actual_own'] = working_df.apply(lambda row: sum(st.session_state['ownership_dict'].get(player, 0) for player in row[st.session_state['player_columns']]), axis=1)
|
187 |
working_df['sorted'] = working_df[st.session_state['player_columns']].apply(
|
|
|
223 |
axis=1
|
224 |
)
|
225 |
if sport_select == 'GOLF':
|
226 |
+
working_df['salary'] = working_df.apply(lambda row: sum(st.session_state['salary_dict'].get(player, 0) for player in row), axis=1)
|
227 |
working_df['actual_fpts'] = working_df.apply(lambda row: sum(st.session_state['actual_dict'].get(player, 0) for player in row), axis=1)
|
228 |
else:
|
229 |
# Modified salary calculation with 1.5x multiplier for first player
|