James McCool
commited on
Commit
·
fba063e
1
Parent(s):
c618f4d
Refactor app.py to enhance user interface by updating form button labels to "Portfolio" and "Export" for clarity. Introduce informative messages to guide users on the functionality of each button, improving overall user experience in data submission processes.
Browse files
app.py
CHANGED
@@ -1034,10 +1034,11 @@ with tab2:
|
|
1034 |
stack_remove = st.multiselect("If Specific Stacks, Which to remove?", options=sorted(list(set(st.session_state['stack_dict'].values()))), default=[])
|
1035 |
|
1036 |
submitted_col, export_col = st.columns(2)
|
|
|
1037 |
with submitted_col:
|
1038 |
-
reg_submitted = st.form_submit_button("
|
1039 |
with export_col:
|
1040 |
-
exp_submitted = st.form_submit_button("
|
1041 |
|
1042 |
if reg_submitted:
|
1043 |
st.session_state['settings_base'] = False
|
@@ -1093,8 +1094,13 @@ with tab2:
|
|
1093 |
else:
|
1094 |
size_include = []
|
1095 |
|
1096 |
-
|
1097 |
-
|
|
|
|
|
|
|
|
|
|
|
1098 |
st.session_state['settings_base'] = False
|
1099 |
parsed_frame = st.session_state['working_frame'].copy()
|
1100 |
if player_remove:
|
@@ -1142,6 +1148,54 @@ with tab2:
|
|
1142 |
parsed_frame = parsed_frame[parsed_frame['Size'].isin(size_include)]
|
1143 |
st.session_state['working_frame'] = parsed_frame.sort_values(by='median', ascending=False).reset_index(drop=True)
|
1144 |
st.session_state['export_merge'] = st.session_state['working_frame'].copy()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1145 |
|
1146 |
with st.expander('Trimming Options'):
|
1147 |
with st.form(key='trim_form'):
|
@@ -1168,21 +1222,37 @@ with tab2:
|
|
1168 |
with max_trim:
|
1169 |
own_threshold_high = st.number_input("Max", value=float(st.session_state['trimming_dict_maxes'][own_type]), min_value=0.0, step=1.0, key='max_trim')
|
1170 |
|
1171 |
-
|
1172 |
-
|
|
|
|
|
|
|
|
|
|
|
1173 |
st.session_state['settings_base'] = False
|
1174 |
st.write('initiated')
|
1175 |
parsed_frame = st.session_state['working_frame'].copy()
|
1176 |
parsed_frame = trim_portfolio(parsed_frame, trim_slack_var, performance_type, own_type, performance_threshold_high, performance_threshold_low, own_threshold_high, own_threshold_low)
|
1177 |
st.session_state['working_frame'] = parsed_frame.sort_values(by='median', ascending=False)
|
1178 |
st.session_state['export_merge'] = st.session_state['working_frame'].copy()
|
|
|
|
|
|
|
|
|
|
|
|
|
1179 |
with st.expander('Presets'):
|
1180 |
st.info("Still heavily in testing here, I'll announce when they are ready for use.")
|
1181 |
with st.form(key='Small Field Preset'):
|
1182 |
preset_choice = st.selectbox("Preset", options=['Small Field (Heavy Own)', 'Large Field (Manage Diversity)', 'Hedge Chalk (Manage Leverage)', 'Volatility (Heavy Lineup Edge)'], index=0)
|
1183 |
lineup_target = st.number_input("Lineups to produce", value=150, min_value=1, step=1)
|
1184 |
-
|
1185 |
-
|
|
|
|
|
|
|
|
|
|
|
1186 |
st.session_state['settings_base'] = False
|
1187 |
if preset_choice == 'Small Field (Heavy Own)':
|
1188 |
parsed_frame = small_field_preset(st.session_state['working_frame'], lineup_target, excluded_cols, sport_var)
|
@@ -1197,16 +1267,42 @@ with tab2:
|
|
1197 |
|
1198 |
st.session_state['working_frame'] = parsed_frame.reset_index(drop=True)
|
1199 |
st.session_state['export_merge'] = st.session_state['working_frame'].copy()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1200 |
with st.expander('Stratify'):
|
1201 |
with st.form(key='Stratification'):
|
1202 |
sorting_choice = st.selectbox("Stat Choice", options=['median', 'Own', 'Weighted Own', 'Geomean', 'Lineup Edge', 'Finish_percentile', 'Diversity'], index=0)
|
1203 |
lineup_target = st.number_input("Lineups to produce", value=150, min_value=1, step=1)
|
1204 |
-
|
1205 |
-
|
|
|
|
|
|
|
|
|
|
|
1206 |
st.session_state['settings_base'] = False
|
1207 |
parsed_frame = stratification_function(st.session_state['working_frame'], lineup_target, excluded_cols, sport_var, sorting_choice)
|
1208 |
st.session_state['working_frame'] = parsed_frame.reset_index(drop=True)
|
1209 |
st.session_state['export_merge'] = st.session_state['working_frame'].copy()
|
|
|
|
|
|
|
|
|
|
|
1210 |
with st.expander('Exposure Management'):
|
1211 |
with st.form(key='Exposures'):
|
1212 |
exposure_player = st.selectbox("Player", options=sorted(list(player_names)))
|
@@ -1216,8 +1312,13 @@ with tab2:
|
|
1216 |
else:
|
1217 |
exposure_stack_bool = 'No'
|
1218 |
remove_teams_exposure = st.multiselect("Removed/Locked teams?", options=sorted(list(set(st.session_state['projections_df']['team'].unique()))), default=[])
|
1219 |
-
|
1220 |
-
|
|
|
|
|
|
|
|
|
|
|
1221 |
st.session_state['settings_base'] = False
|
1222 |
parsed_frame = exposure_spread(st.session_state['working_frame'], exposure_player, exposure_target, exposure_stack_bool, remove_teams_exposure, st.session_state['projections_df'], sport_var, type_var, salary_max)
|
1223 |
st.session_state['working_frame'] = parsed_frame.reset_index(drop=True)
|
@@ -1279,6 +1380,68 @@ with tab2:
|
|
1279 |
print(st.session_state['working_frame'].head(10))
|
1280 |
st.session_state['working_frame'] = predict_dupes(st.session_state['working_frame'], st.session_state['map_dict'], site_var, type_var, Contest_Size, strength_var, sport_var)
|
1281 |
st.session_state['export_merge'] = st.session_state['working_frame'].copy()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1282 |
|
1283 |
with st.container():
|
1284 |
if 'export_base' not in st.session_state:
|
|
|
1034 |
stack_remove = st.multiselect("If Specific Stacks, Which to remove?", options=sorted(list(set(st.session_state['stack_dict'].values()))), default=[])
|
1035 |
|
1036 |
submitted_col, export_col = st.columns(2)
|
1037 |
+
st.info("Portfolio Button applies to your overall Portfolio, Export button applies to your Custom Export")
|
1038 |
with submitted_col:
|
1039 |
+
reg_submitted = st.form_submit_button("Portfolio")
|
1040 |
with export_col:
|
1041 |
+
exp_submitted = st.form_submit_button("Export")
|
1042 |
|
1043 |
if reg_submitted:
|
1044 |
st.session_state['settings_base'] = False
|
|
|
1094 |
else:
|
1095 |
size_include = []
|
1096 |
|
1097 |
+
submitted_col, export_col = st.columns(2)
|
1098 |
+
st.info("Portfolio Button applies to your overall Portfolio, Export button applies to your Custom Export")
|
1099 |
+
with submitted_col:
|
1100 |
+
reg_submitted = st.form_submit_button("Portfolio")
|
1101 |
+
with export_col:
|
1102 |
+
exp_submitted = st.form_submit_button("Export")
|
1103 |
+
if reg_submitted:
|
1104 |
st.session_state['settings_base'] = False
|
1105 |
parsed_frame = st.session_state['working_frame'].copy()
|
1106 |
if player_remove:
|
|
|
1148 |
parsed_frame = parsed_frame[parsed_frame['Size'].isin(size_include)]
|
1149 |
st.session_state['working_frame'] = parsed_frame.sort_values(by='median', ascending=False).reset_index(drop=True)
|
1150 |
st.session_state['export_merge'] = st.session_state['working_frame'].copy()
|
1151 |
+
elif exp_submitted:
|
1152 |
+
st.session_state['settings_base'] = False
|
1153 |
+
parsed_frame = st.session_state['export_base'].copy()
|
1154 |
+
if player_remove:
|
1155 |
+
# Create mask for lineups that contain any of the removed players
|
1156 |
+
player_columns = [col for col in parsed_frame.columns if col not in excluded_cols]
|
1157 |
+
remove_mask = parsed_frame[player_columns].apply(
|
1158 |
+
lambda row: not any(player in list(row) for player in player_remove), axis=1
|
1159 |
+
)
|
1160 |
+
parsed_frame = parsed_frame[remove_mask]
|
1161 |
+
|
1162 |
+
if player_lock:
|
1163 |
+
# Create mask for lineups that contain all locked players
|
1164 |
+
player_columns = [col for col in parsed_frame.columns if col not in excluded_cols]
|
1165 |
+
|
1166 |
+
lock_mask = parsed_frame[player_columns].apply(
|
1167 |
+
lambda row: all(player in list(row) for player in player_lock), axis=1
|
1168 |
+
)
|
1169 |
+
parsed_frame = parsed_frame[lock_mask]
|
1170 |
+
|
1171 |
+
if team_include:
|
1172 |
+
# Create a copy of the frame with player names replaced by teams, excluding SP1 and SP2
|
1173 |
+
filtered_player_columns = [col for col in player_columns if col not in ['SP1', 'SP2']]
|
1174 |
+
team_frame = parsed_frame[filtered_player_columns].apply(
|
1175 |
+
lambda x: x.map(st.session_state['map_dict']['team_map'])
|
1176 |
+
)
|
1177 |
+
# Create mask for lineups that contain any of the included teams
|
1178 |
+
include_mask = team_frame.apply(
|
1179 |
+
lambda row: any(team in list(row) for team in team_include), axis=1
|
1180 |
+
)
|
1181 |
+
parsed_frame = parsed_frame[include_mask]
|
1182 |
+
|
1183 |
+
if team_remove:
|
1184 |
+
# Create a copy of the frame with player names replaced by teams, excluding SP1 and SP2
|
1185 |
+
filtered_player_columns = [col for col in player_columns if col not in ['SP1', 'SP2']]
|
1186 |
+
team_frame = parsed_frame[filtered_player_columns].apply(
|
1187 |
+
lambda x: x.map(st.session_state['map_dict']['team_map'])
|
1188 |
+
)
|
1189 |
+
# Create mask for lineups that don't contain any of the removed teams
|
1190 |
+
remove_mask = team_frame.apply(
|
1191 |
+
lambda row: not any(team in list(row) for team in team_remove), axis=1
|
1192 |
+
)
|
1193 |
+
parsed_frame = parsed_frame[remove_mask]
|
1194 |
+
|
1195 |
+
if size_include:
|
1196 |
+
parsed_frame = parsed_frame[parsed_frame['Size'].isin(size_include)]
|
1197 |
+
st.session_state['export_base'] = parsed_frame.sort_values(by='median', ascending=False).reset_index(drop=True)
|
1198 |
+
st.session_state['export_merge'] = st.session_state['export_base'].copy()
|
1199 |
|
1200 |
with st.expander('Trimming Options'):
|
1201 |
with st.form(key='trim_form'):
|
|
|
1222 |
with max_trim:
|
1223 |
own_threshold_high = st.number_input("Max", value=float(st.session_state['trimming_dict_maxes'][own_type]), min_value=0.0, step=1.0, key='max_trim')
|
1224 |
|
1225 |
+
submitted_col, export_col = st.columns(2)
|
1226 |
+
st.info("Portfolio Button applies to your overall Portfolio, Export button applies to your Custom Export")
|
1227 |
+
with submitted_col:
|
1228 |
+
reg_submitted = st.form_submit_button("Portfolio")
|
1229 |
+
with export_col:
|
1230 |
+
exp_submitted = st.form_submit_button("Export")
|
1231 |
+
if reg_submitted:
|
1232 |
st.session_state['settings_base'] = False
|
1233 |
st.write('initiated')
|
1234 |
parsed_frame = st.session_state['working_frame'].copy()
|
1235 |
parsed_frame = trim_portfolio(parsed_frame, trim_slack_var, performance_type, own_type, performance_threshold_high, performance_threshold_low, own_threshold_high, own_threshold_low)
|
1236 |
st.session_state['working_frame'] = parsed_frame.sort_values(by='median', ascending=False)
|
1237 |
st.session_state['export_merge'] = st.session_state['working_frame'].copy()
|
1238 |
+
elif exp_submitted:
|
1239 |
+
st.session_state['settings_base'] = False
|
1240 |
+
parsed_frame = st.session_state['export_base'].copy()
|
1241 |
+
parsed_frame = trim_portfolio(parsed_frame, trim_slack_var, performance_type, own_type, performance_threshold_high, performance_threshold_low, own_threshold_high, own_threshold_low)
|
1242 |
+
st.session_state['export_base'] = parsed_frame.sort_values(by='median', ascending=False)
|
1243 |
+
st.session_state['export_merge'] = st.session_state['export_base'].copy()
|
1244 |
with st.expander('Presets'):
|
1245 |
st.info("Still heavily in testing here, I'll announce when they are ready for use.")
|
1246 |
with st.form(key='Small Field Preset'):
|
1247 |
preset_choice = st.selectbox("Preset", options=['Small Field (Heavy Own)', 'Large Field (Manage Diversity)', 'Hedge Chalk (Manage Leverage)', 'Volatility (Heavy Lineup Edge)'], index=0)
|
1248 |
lineup_target = st.number_input("Lineups to produce", value=150, min_value=1, step=1)
|
1249 |
+
submitted_col, export_col = st.columns(2)
|
1250 |
+
st.info("Portfolio Button applies to your overall Portfolio, Export button applies to your Custom Export")
|
1251 |
+
with submitted_col:
|
1252 |
+
reg_submitted = st.form_submit_button("Portfolio")
|
1253 |
+
with export_col:
|
1254 |
+
exp_submitted = st.form_submit_button("Export")
|
1255 |
+
if reg_submitted:
|
1256 |
st.session_state['settings_base'] = False
|
1257 |
if preset_choice == 'Small Field (Heavy Own)':
|
1258 |
parsed_frame = small_field_preset(st.session_state['working_frame'], lineup_target, excluded_cols, sport_var)
|
|
|
1267 |
|
1268 |
st.session_state['working_frame'] = parsed_frame.reset_index(drop=True)
|
1269 |
st.session_state['export_merge'] = st.session_state['working_frame'].copy()
|
1270 |
+
elif exp_submitted:
|
1271 |
+
st.session_state['settings_base'] = False
|
1272 |
+
parsed_frame = st.session_state['export_base'].copy()
|
1273 |
+
if preset_choice == 'Small Field (Heavy Own)':
|
1274 |
+
parsed_frame = small_field_preset(st.session_state['export_base'], lineup_target, excluded_cols, sport_var)
|
1275 |
+
elif preset_choice == 'Large Field (Manage Diversity)':
|
1276 |
+
parsed_frame = large_field_preset(st.session_state['export_base'], lineup_target, excluded_cols, sport_var)
|
1277 |
+
elif preset_choice == 'Volatility (Heavy Lineup Edge)':
|
1278 |
+
parsed_frame = volatility_preset(st.session_state['export_base'], lineup_target, excluded_cols, sport_var)
|
1279 |
+
elif preset_choice == 'Hedge Chalk (Manage Leverage)':
|
1280 |
+
parsed_frame = hedging_preset(st.session_state['export_base'], lineup_target, st.session_state['projections_df'], sport_var)
|
1281 |
+
elif preset_choice == 'Reduce Volatility (Manage Own)':
|
1282 |
+
parsed_frame = reduce_volatility_preset(st.session_state['export_base'], lineup_target, excluded_cols, sport_var)
|
1283 |
+
|
1284 |
+
st.session_state['export_base'] = parsed_frame.reset_index(drop=True)
|
1285 |
+
st.session_state['export_merge'] = st.session_state['export_base'].copy()
|
1286 |
with st.expander('Stratify'):
|
1287 |
with st.form(key='Stratification'):
|
1288 |
sorting_choice = st.selectbox("Stat Choice", options=['median', 'Own', 'Weighted Own', 'Geomean', 'Lineup Edge', 'Finish_percentile', 'Diversity'], index=0)
|
1289 |
lineup_target = st.number_input("Lineups to produce", value=150, min_value=1, step=1)
|
1290 |
+
submitted_col, export_col = st.columns(2)
|
1291 |
+
st.info("Portfolio Button applies to your overall Portfolio, Export button applies to your Custom Export")
|
1292 |
+
with submitted_col:
|
1293 |
+
reg_submitted = st.form_submit_button("Portfolio")
|
1294 |
+
with export_col:
|
1295 |
+
exp_submitted = st.form_submit_button("Export")
|
1296 |
+
if reg_submitted:
|
1297 |
st.session_state['settings_base'] = False
|
1298 |
parsed_frame = stratification_function(st.session_state['working_frame'], lineup_target, excluded_cols, sport_var, sorting_choice)
|
1299 |
st.session_state['working_frame'] = parsed_frame.reset_index(drop=True)
|
1300 |
st.session_state['export_merge'] = st.session_state['working_frame'].copy()
|
1301 |
+
elif exp_submitted:
|
1302 |
+
st.session_state['settings_base'] = False
|
1303 |
+
parsed_frame = stratification_function(st.session_state['export_base'], lineup_target, excluded_cols, sport_var, sorting_choice)
|
1304 |
+
st.session_state['export_base'] = parsed_frame.reset_index(drop=True)
|
1305 |
+
st.session_state['export_merge'] = st.session_state['export_base'].copy()
|
1306 |
with st.expander('Exposure Management'):
|
1307 |
with st.form(key='Exposures'):
|
1308 |
exposure_player = st.selectbox("Player", options=sorted(list(player_names)))
|
|
|
1312 |
else:
|
1313 |
exposure_stack_bool = 'No'
|
1314 |
remove_teams_exposure = st.multiselect("Removed/Locked teams?", options=sorted(list(set(st.session_state['projections_df']['team'].unique()))), default=[])
|
1315 |
+
submitted_col, export_col = st.columns(2)
|
1316 |
+
st.info("Portfolio Button applies to your overall Portfolio, Export button applies to your Custom Export")
|
1317 |
+
with submitted_col:
|
1318 |
+
reg_submitted = st.form_submit_button("Portfolio")
|
1319 |
+
with export_col:
|
1320 |
+
exp_submitted = st.form_submit_button("Export")
|
1321 |
+
if reg_submitted:
|
1322 |
st.session_state['settings_base'] = False
|
1323 |
parsed_frame = exposure_spread(st.session_state['working_frame'], exposure_player, exposure_target, exposure_stack_bool, remove_teams_exposure, st.session_state['projections_df'], sport_var, type_var, salary_max)
|
1324 |
st.session_state['working_frame'] = parsed_frame.reset_index(drop=True)
|
|
|
1380 |
print(st.session_state['working_frame'].head(10))
|
1381 |
st.session_state['working_frame'] = predict_dupes(st.session_state['working_frame'], st.session_state['map_dict'], site_var, type_var, Contest_Size, strength_var, sport_var)
|
1382 |
st.session_state['export_merge'] = st.session_state['working_frame'].copy()
|
1383 |
+
elif exp_submitted:
|
1384 |
+
st.session_state['settings_base'] = False
|
1385 |
+
parsed_frame = exposure_spread(st.session_state['export_base'], exposure_player, exposure_target, exposure_stack_bool, remove_teams_exposure, st.session_state['projections_df'], sport_var, type_var, salary_max)
|
1386 |
+
st.session_state['export_base'] = parsed_frame.reset_index(drop=True)
|
1387 |
+
if type_var == 'Classic':
|
1388 |
+
if sport_var == 'CS2' or sport_var == 'LOL':
|
1389 |
+
# Calculate salary (CPT uses cpt_salary_map, others use salary_map)
|
1390 |
+
st.session_state['export_base']['salary'] = st.session_state['export_base'].apply(
|
1391 |
+
lambda row: st.session_state['map_dict']['cpt_salary_map'].get(row.iloc[0], 0) +
|
1392 |
+
sum(st.session_state['map_dict']['salary_map'].get(player, 0) for player in row.iloc[1:]),
|
1393 |
+
axis=1
|
1394 |
+
)
|
1395 |
+
|
1396 |
+
# Calculate median (CPT uses cpt_proj_map, others use proj_map)
|
1397 |
+
st.session_state['export_base']['median'] = st.session_state['export_base'].apply(
|
1398 |
+
lambda row: st.session_state['map_dict']['cpt_proj_map'].get(row.iloc[0], 0) +
|
1399 |
+
sum(st.session_state['map_dict']['proj_map'].get(player, 0) for player in row.iloc[1:]),
|
1400 |
+
axis=1
|
1401 |
+
)
|
1402 |
+
|
1403 |
+
# Calculate ownership (CPT uses cpt_own_map, others use own_map)
|
1404 |
+
st.session_state['export_base']['Own'] = st.session_state['export_base'].apply(
|
1405 |
+
lambda row: st.session_state['map_dict']['cpt_own_map'].get(row.iloc[0], 0) +
|
1406 |
+
sum(st.session_state['map_dict']['own_map'].get(player, 0) for player in row.iloc[1:]),
|
1407 |
+
axis=1
|
1408 |
+
)
|
1409 |
+
|
1410 |
+
elif sport_var != 'CS2' and sport_var != 'LOL':
|
1411 |
+
st.session_state['export_base']['salary'] = st.session_state['export_base'].apply(lambda row: sum(st.session_state['map_dict']['salary_map'].get(player, 0) for player in row), axis=1)
|
1412 |
+
st.session_state['export_base']['median'] = st.session_state['export_base'].apply(lambda row: sum(st.session_state['map_dict']['proj_map'].get(player, 0) for player in row), axis=1)
|
1413 |
+
st.session_state['export_base']['Own'] = st.session_state['export_base'].apply(lambda row: sum(st.session_state['map_dict']['own_map'].get(player, 0) for player in row), axis=1)
|
1414 |
+
if 'stack_dict' in st.session_state:
|
1415 |
+
st.session_state['export_base']['Stack'] = st.session_state['export_base'].index.map(st.session_state['stack_dict'])
|
1416 |
+
st.session_state['export_base']['Size'] = st.session_state['export_base'].index.map(st.session_state['size_dict'])
|
1417 |
+
elif type_var == 'Showdown':
|
1418 |
+
# Calculate salary (CPT uses cpt_salary_map, others use salary_map)
|
1419 |
+
st.session_state['export_base']['salary'] = st.session_state['export_base'].apply(
|
1420 |
+
lambda row: st.session_state['map_dict']['cpt_salary_map'].get(row.iloc[0], 0) +
|
1421 |
+
sum(st.session_state['map_dict']['salary_map'].get(player, 0) for player in row.iloc[1:]),
|
1422 |
+
axis=1
|
1423 |
+
)
|
1424 |
+
|
1425 |
+
# Calculate median (CPT uses cpt_proj_map, others use proj_map)
|
1426 |
+
st.session_state['export_base']['median'] = st.session_state['export_base'].apply(
|
1427 |
+
lambda row: st.session_state['map_dict']['cpt_proj_map'].get(row.iloc[0], 0) +
|
1428 |
+
sum(st.session_state['map_dict']['proj_map'].get(player, 0) for player in row.iloc[1:]),
|
1429 |
+
axis=1
|
1430 |
+
)
|
1431 |
+
|
1432 |
+
# Calculate ownership (CPT uses cpt_own_map, others use own_map)
|
1433 |
+
st.session_state['export_base']['Own'] = st.session_state['export_base'].apply(
|
1434 |
+
lambda row: st.session_state['map_dict']['cpt_own_map'].get(row.iloc[0], 0) +
|
1435 |
+
sum(st.session_state['map_dict']['own_map'].get(player, 0) for player in row.iloc[1:]),
|
1436 |
+
axis=1
|
1437 |
+
)
|
1438 |
+
# st.session_state['export_base']['Own'] = st.session_state['export_base']['Own'].astype('float32')
|
1439 |
+
st.session_state['export_base']['median'] = st.session_state['export_base']['median'].astype('float32')
|
1440 |
+
st.session_state['export_base']['salary'] = st.session_state['export_base']['salary'].astype('uint16')
|
1441 |
+
|
1442 |
+
print(st.session_state['export_base'].head(10))
|
1443 |
+
st.session_state['export_base'] = predict_dupes(st.session_state['export_base'], st.session_state['map_dict'], site_var, type_var, Contest_Size, strength_var, sport_var)
|
1444 |
+
st.session_state['export_merge'] = st.session_state['export_base'].copy()
|
1445 |
|
1446 |
with st.container():
|
1447 |
if 'export_base' not in st.session_state:
|