Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -137,7 +137,7 @@ with tab2:
|
|
| 137 |
init_baselines = init_baselines[init_baselines['Team'].isin(team_var1)]
|
| 138 |
init_baselines = init_baselines[~init_baselines['Player'].isin(avoid_var1)]
|
| 139 |
ownframe = init_baselines.copy()
|
| 140 |
-
ownframe['Own'] = ownframe['Own
|
| 141 |
raw_baselines = ownframe[['Player', 'Salary', 'Position', 'Team', 'Opp', 'Line', 'PP Unit', 'Median', 'Own']]
|
| 142 |
raw_baselines = raw_baselines.sort_values(by='Median', ascending=False)
|
| 143 |
raw_baselines['lock'] = np.where(raw_baselines['Player'].isin(lock_var1), 1, 0)
|
|
@@ -350,107 +350,107 @@ with tab2:
|
|
| 350 |
del lineup_final[lineup_final.columns[1]]
|
| 351 |
lineup_final = lineup_final.reset_index(drop=True)
|
| 352 |
|
| 353 |
-
if site_var1 == 'Draftkings':
|
| 354 |
-
|
| 355 |
-
|
| 356 |
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
|
| 404 |
-
elif site_var1 == 'Fanduel':
|
| 405 |
-
|
| 406 |
-
|
| 407 |
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
|
| 438 |
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
| 444 |
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
| 450 |
|
| 451 |
-
|
| 452 |
-
|
| 453 |
-
|
| 454 |
|
| 455 |
lineup_test = lineup_final
|
| 456 |
lineup_final = lineup_final.T
|
|
@@ -482,9 +482,9 @@ with tab2:
|
|
| 482 |
x += 1
|
| 483 |
|
| 484 |
if site_var1 == 'Draftkings':
|
| 485 |
-
portfolio.rename(columns={0: "
|
| 486 |
elif site_var1 == 'Fanduel':
|
| 487 |
-
portfolio.rename(columns={0: "
|
| 488 |
portfolio = portfolio.dropna()
|
| 489 |
portfolio = portfolio.reset_index()
|
| 490 |
portfolio['Lineup_num'] = portfolio['index'] + 1
|
|
|
|
| 137 |
init_baselines = init_baselines[init_baselines['Team'].isin(team_var1)]
|
| 138 |
init_baselines = init_baselines[~init_baselines['Player'].isin(avoid_var1)]
|
| 139 |
ownframe = init_baselines.copy()
|
| 140 |
+
ownframe['Own'] = ownframe['Own'] * (900 / ownframe['Own'].sum())
|
| 141 |
raw_baselines = ownframe[['Player', 'Salary', 'Position', 'Team', 'Opp', 'Line', 'PP Unit', 'Median', 'Own']]
|
| 142 |
raw_baselines = raw_baselines.sort_values(by='Median', ascending=False)
|
| 143 |
raw_baselines['lock'] = np.where(raw_baselines['Player'].isin(lock_var1), 1, 0)
|
|
|
|
| 350 |
del lineup_final[lineup_final.columns[1]]
|
| 351 |
lineup_final = lineup_final.reset_index(drop=True)
|
| 352 |
|
| 353 |
+
# if site_var1 == 'Draftkings':
|
| 354 |
+
# line_hold = lineup_final[['Names']]
|
| 355 |
+
# line_hold['pos'] = line_hold['Names'].map(player_pos)
|
| 356 |
|
| 357 |
+
# cvar = 0
|
| 358 |
+
# for pname in range(0,len(line_hold)):
|
| 359 |
+
# if cvar == 2:
|
| 360 |
+
# pname = len(line_hold)
|
| 361 |
+
# elif cvar < 2:
|
| 362 |
+
# if line_hold.iat[pname,1] == 'C':
|
| 363 |
+
# if line_hold.iat[pname,0] not in p_used:
|
| 364 |
+
# sorted_lineup.append(line_hold.iat[pname,0])
|
| 365 |
+
# cvar = cvar + 1
|
| 366 |
+
# p_used.extend(sorted_lineup)
|
| 367 |
+
# wvar = 0
|
| 368 |
+
# for pname in range(0,len(line_hold)):
|
| 369 |
+
# if wvar == 3:
|
| 370 |
+
# pname = len(line_hold)
|
| 371 |
+
# elif wvar < 3:
|
| 372 |
+
# if line_hold.iat[pname,1] in ['RW', 'LW', 'W']:
|
| 373 |
+
# if line_hold.iat[pname,0] not in p_used:
|
| 374 |
+
# sorted_lineup.append(line_hold.iat[pname,0])
|
| 375 |
+
# wvar = wvar + 1
|
| 376 |
+
# p_used.extend(sorted_lineup)
|
| 377 |
+
# dvar = 0
|
| 378 |
+
# for pname in range(0,len(line_hold)):
|
| 379 |
+
# if dvar == 2:
|
| 380 |
+
# pname = len(line_hold)
|
| 381 |
+
# elif dvar < 2:
|
| 382 |
+
# if line_hold.iat[pname,1] == "D":
|
| 383 |
+
# if line_hold.iat[pname,0] not in p_used:
|
| 384 |
+
# sorted_lineup.append(line_hold.iat[pname,0])
|
| 385 |
+
# dvar = dvar + 1
|
| 386 |
+
# p_used.extend(sorted_lineup)
|
| 387 |
|
| 388 |
+
# for pname in range(0,len(line_hold)):
|
| 389 |
+
# if line_hold.iat[pname,1] == 'G':
|
| 390 |
+
# if line_hold.iat[pname,0] not in p_used:
|
| 391 |
+
# sorted_lineup.append(line_hold.iat[pname,0])
|
| 392 |
+
# p_used.extend(sorted_lineup)
|
| 393 |
|
| 394 |
+
# for pname in range(0,len(line_hold)):
|
| 395 |
+
# if line_hold.iat[pname,1] != 'G':
|
| 396 |
+
# if line_hold.iat[pname,0] not in p_used:
|
| 397 |
+
# sorted_lineup.append(line_hold.iat[pname,0])
|
| 398 |
+
# p_used.extend(sorted_lineup)
|
| 399 |
|
| 400 |
+
# lineup_final['sorted'] = sorted_lineup
|
| 401 |
+
# lineup_final = lineup_final.drop(columns=['Names'])
|
| 402 |
+
# lineup_final.rename(columns={"sorted": "Names"}, inplace = True)
|
| 403 |
|
| 404 |
+
# elif site_var1 == 'Fanduel':
|
| 405 |
+
# line_hold = lineup_final[['Names']]
|
| 406 |
+
# line_hold['pos'] = line_hold['Names'].map(player_pos)
|
| 407 |
|
| 408 |
+
# cvar = 0
|
| 409 |
+
# for pname in range(0,len(line_hold)):
|
| 410 |
+
# if cvar == 2:
|
| 411 |
+
# pname = len(line_hold)
|
| 412 |
+
# elif cvar < 2:
|
| 413 |
+
# if line_hold.iat[pname,1] == 'C':
|
| 414 |
+
# if line_hold.iat[pname,0] not in p_used:
|
| 415 |
+
# sorted_lineup.append(line_hold.iat[pname,0])
|
| 416 |
+
# cvar = cvar + 1
|
| 417 |
+
# p_used.extend(sorted_lineup)
|
| 418 |
+
# wvar = 0
|
| 419 |
+
# for pname in range(0,len(line_hold)):
|
| 420 |
+
# if wvar == 2:
|
| 421 |
+
# pname = len(line_hold)
|
| 422 |
+
# elif wvar < 2:
|
| 423 |
+
# if line_hold.iat[pname,1] == 'W':
|
| 424 |
+
# if line_hold.iat[pname,0] not in p_used:
|
| 425 |
+
# sorted_lineup.append(line_hold.iat[pname,0])
|
| 426 |
+
# wvar = wvar + 1
|
| 427 |
+
# p_used.extend(sorted_lineup)
|
| 428 |
+
# dvar = 0
|
| 429 |
+
# for pname in range(0,len(line_hold)):
|
| 430 |
+
# if dvar == 2:
|
| 431 |
+
# pname = len(line_hold)
|
| 432 |
+
# elif dvar < 2:
|
| 433 |
+
# if line_hold.iat[pname,1] == "D":
|
| 434 |
+
# if line_hold.iat[pname,0] not in p_used:
|
| 435 |
+
# sorted_lineup.append(line_hold.iat[pname,0])
|
| 436 |
+
# dvar = dvar + 1
|
| 437 |
+
# p_used.extend(sorted_lineup)
|
| 438 |
|
| 439 |
+
# for pname in range(0,len(line_hold)):
|
| 440 |
+
# if line_hold.iat[pname,1] != 'G':
|
| 441 |
+
# if line_hold.iat[pname,0] not in p_used:
|
| 442 |
+
# sorted_lineup.append(line_hold.iat[pname,0])
|
| 443 |
+
# p_used.extend(sorted_lineup)
|
| 444 |
|
| 445 |
+
# for pname in range(0,len(line_hold)):
|
| 446 |
+
# if line_hold.iat[pname,1] == 'G':
|
| 447 |
+
# if line_hold.iat[pname,0] not in p_used:
|
| 448 |
+
# sorted_lineup.append(line_hold.iat[pname,0])
|
| 449 |
+
# p_used.extend(sorted_lineup)
|
| 450 |
|
| 451 |
+
# lineup_final['sorted'] = sorted_lineup
|
| 452 |
+
# lineup_final = lineup_final.drop(columns=['Names'])
|
| 453 |
+
# lineup_final.rename(columns={"sorted": "Names"}, inplace = True)
|
| 454 |
|
| 455 |
lineup_test = lineup_final
|
| 456 |
lineup_final = lineup_final.T
|
|
|
|
| 482 |
x += 1
|
| 483 |
|
| 484 |
if site_var1 == 'Draftkings':
|
| 485 |
+
portfolio.rename(columns={0: "PG", 1: "SG", 2: "SF", 3: "PF", 4: "C", 5: "G", 6: "F", 7: "UTIL"}, inplace = True)
|
| 486 |
elif site_var1 == 'Fanduel':
|
| 487 |
+
portfolio.rename(columns={0: "PG", 1: "SG", 2: "SF", 3: "PF", 4: "C", 5: "G", 6: "F", 7: "UTIL"}, inplace = True)
|
| 488 |
portfolio = portfolio.dropna()
|
| 489 |
portfolio = portfolio.reset_index()
|
| 490 |
portfolio['Lineup_num'] = portfolio['index'] + 1
|