Spaces:
Running
Running
File size: 22,736 Bytes
95b08b3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 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 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 456 457 458 459 460 461 462 463 464 465 466 467 468 469 |
from numpy import nan as np_nan
from numpy import where as np_where
from numpy import random as np_random
from numpy import zeros as np_zeros
from numpy import array as np_array
from pandas import concat as pd_concat
from pandas import merge as pd_merge
from pandas import DataFrame
def DK_MLB_ROO_Build(projections_file, floor_var, ceiling_var, std_var, distribution_type):
sp_frame = projections_file[projections_file['Position'].str.contains('P')]
hit_frame = projections_file[~projections_file['Position'].str.contains('P')]
sp_norm_var = 200 / sp_frame['Own'].sum()
sp_frame['Own'] = sp_frame['Own'] * sp_norm_var
hit_norm_var = 800 / hit_frame['Own'].sum()
hit_frame['Own'] = hit_frame['Own'] * hit_norm_var
working_roo = pd_concat([sp_frame, hit_frame])
own_dict = dict(zip(working_roo.Player, working_roo.Own))
team_dict = dict(zip(working_roo.Player, working_roo.Team))
player_id_dict = dict(zip(working_roo.Player, working_roo.player_ID))
total_sims = 1000
basic_own_df = working_roo.copy()
basic_own_df['name_team'] = basic_own_df['Player'] + basic_own_df['Position']
def calculate_ownership(df):
# Filter the dataframe based on the position
frame = df.copy()
# Calculate Small Field Own%
frame['Base Own%'] = np_where(
(frame['Own'] - frame['Own'].mean() >= 0),
frame['Own'] * (5 * (frame['Own'] - (frame['Own'].mean() / 1.5)) / 100) + frame['Own'].mean(),
frame['Own']
)
frame['Base Own%'] = np_where(
frame['Base Own%'] > 85,
85,
frame['Base Own%']
)
# Calculate Small Field Own%
frame['Small Field Own%'] = np_where(
(frame['Own'] - frame['Own'].mean() >= 0),
frame['Own'] * (6 * (frame['Own'] - frame['Own'].mean()) / 100) + frame['Own'].mean(),
frame['Own']
)
frame['Small Field Own%'] = np_where(
frame['Small Field Own%'] > 85,
85,
frame['Small Field Own%']
)
# Calculate Large Field Own%
frame['Large Field Own%'] = np_where(
(frame['Own'] - frame['Own'].mean() >= 0),
frame['Own'] * (2.5 * (frame['Own'] - frame['Own'].mean()) / 100) + frame['Own'].mean(),
frame['Own']
)
frame['Large Field Own%'] = np_where(
frame['Large Field Own%'] > 85,
85,
frame['Large Field Own%']
)
# Calculate Cash Own%
frame['Cash Own%'] = np_where(
(frame['Own'] - frame['Own'].mean() >= 0),
frame['Own'] * (8 * (frame['Own'] - frame['Own'].mean()) / 100) + frame['Own'].mean(),
frame['Own']
)
frame['Cash Own%'] = np_where(
frame['Cash Own%'] > 85,
85,
frame['Cash Own%']
)
return frame
# Apply the function to each dataframe
basic_own_df = calculate_ownership(basic_own_df)
own_norm_var_reg = 1000 / basic_own_df['Own'].sum()
own_norm_var_small = 1000 / basic_own_df['Small Field Own%'].sum()
own_norm_var_large = 1000 / basic_own_df['Large Field Own%'].sum()
own_norm_var_cash = 1000 / basic_own_df['Cash Own%'].sum()
basic_own_df['Own'] = basic_own_df['Own'] * own_norm_var_reg
basic_own_df['Small_Own'] = basic_own_df['Small Field Own%'] * own_norm_var_small
basic_own_df['Large_Own'] = basic_own_df['Large Field Own%'] * own_norm_var_large
basic_own_df['Cash_Own'] = basic_own_df['Cash Own%'] * own_norm_var_cash
basic_own_df['Own'] = np_where(basic_own_df['Own'] > 90, 90, basic_own_df['Own'])
# Apply the function to each dataframe
basic_own_df = calculate_ownership(basic_own_df)
own_norm_var_reg = 1000 / basic_own_df['Own'].sum()
own_norm_var_small = 1000 / basic_own_df['Small Field Own%'].sum()
own_norm_var_large = 1000 / basic_own_df['Large Field Own%'].sum()
own_norm_var_cash = 1000 / basic_own_df['Cash Own%'].sum()
basic_own_df['Own'] = basic_own_df['Own'] * own_norm_var_reg
basic_own_df['Small_Own'] = basic_own_df['Small Field Own%'] * own_norm_var_small
basic_own_df['Large_Own'] = basic_own_df['Large Field Own%'] * own_norm_var_large
basic_own_df['Cash_Own'] = basic_own_df['Cash Own%'] * own_norm_var_cash
own_dict = dict(zip(basic_own_df.Player, basic_own_df.Own))
small_own_dict = dict(zip(basic_own_df.Player, basic_own_df['Small Field Own%']))
large_own_dict = dict(zip(basic_own_df.Player, basic_own_df['Large Field Own%']))
cash_own_dict = dict(zip(basic_own_df.Player, basic_own_df['Cash Own%']))
team_dict = dict(zip(basic_own_df.name_team, basic_own_df.Team))
opp_dict = dict(zip(basic_own_df.Player, basic_own_df.Opp))
flex_file = basic_own_df[['Player', 'Position', 'Salary', 'Median']]
flex_file = flex_file.rename(columns={"Agg": "Median"})
flex_file['Floor'] = (flex_file['Median'] * floor_var)
flex_file['Ceiling'] = flex_file['Median'] + (5 * ceiling_var)
flex_file['STD'] = (flex_file['Median'] / std_var)
flex_file = flex_file[['Player', 'Position', 'Salary', 'Floor', 'Median', 'Ceiling', 'STD']]
flex_file = flex_file.reset_index(drop=True)
hold_file = flex_file.copy()
overall_file = flex_file.copy()
salary_file = flex_file.copy()
try:
overall_floor_gpu = np_array(overall_file['Floor'])
overall_ceiling_gpu = np_array(overall_file['Ceiling'])
overall_median_gpu = np_array(overall_file['Median'])
overall_std_gpu = np_array(overall_file['STD'])
overall_salary_gpu = np_array(overall_file['Salary'])
data_shape = (len(overall_file['Player']), total_sims) # Example: 1000 rows
salary_array = np_zeros(data_shape)
sim_array = np_zeros(data_shape)
for x in range(0, total_sims):
result_gpu = overall_salary_gpu
salary_array[:, x] = result_gpu
cupy_array = salary_array
salary_file = salary_file.reset_index(drop=True)
salary_cupy = DataFrame(cupy_array, columns=list(range(0, total_sims)))
salary_check_file = pd_concat([salary_file, salary_cupy], axis=1)
except:
for x in range(0,total_sims):
salary_file[x] = salary_file['Salary']
salary_check_file = salary_file.copy()
salary_file=salary_check_file.drop(['Player', 'Position', 'Salary', 'Floor', 'Median', 'Ceiling', 'STD'], axis=1)
salary_file = salary_file.div(1000)
try:
for x in range(0, total_sims):
if distribution_type == 'normal':
# Normal distribution (existing logic)
result_gpu = np_random.normal(overall_median_gpu, overall_std_gpu)
elif distribution_type == 'poisson':
# Poisson distribution - using median as lambda
result_gpu = np_random.poisson(overall_median_gpu)
elif distribution_type == 'bimodal':
# Bimodal distribution - mixture of two normal distributions
# First peak centered at 80% of median, second at 120% of median
if np_random.random() < 0.5:
result_gpu = np_random.normal(overall_floor_gpu, overall_std_gpu)
else:
result_gpu = np_random.normal(overall_ceiling_gpu, overall_std_gpu)
else:
raise ValueError("Invalid distribution type. Must be 'normal', 'poisson', or 'bimodal'")
sim_array[:, x] = result_gpu
add_array = sim_array
overall_file = overall_file.reset_index(drop=True)
df2 = DataFrame(add_array, columns=list(range(0, total_sims)))
check_file = pd_concat([overall_file, df2], axis=1)
except:
for x in range(0,total_sims):
if distribution_type == 'normal':
overall_file[x] = np_random.normal(overall_file['Median'], overall_file['STD'])
elif distribution_type == 'poisson':
overall_file[x] = np_random.poisson(overall_file['Median'])
elif distribution_type == 'bimodal':
# Bimodal distribution fallback
if np_random.random() < 0.5:
overall_file[x] = np_random.normal(overall_file['Median'] * 0.8, overall_file['STD'])
else:
overall_file[x] = np_random.normal(overall_file['Median'] * 1.2, overall_file['STD'])
check_file = overall_file.copy()
overall_file=check_file.drop(['Player', 'Position', 'Salary', 'Floor', 'Median', 'Ceiling', 'STD'], axis=1)
players_only = hold_file[['Player']]
raw_lineups_file = players_only
for x in range(0,total_sims):
maps_dict = {'proj_map':dict(zip(hold_file.Player,overall_file[x]))}
raw_lineups_file[x] = sum([raw_lineups_file['Player'].map(maps_dict['proj_map'])])
players_only[x] = raw_lineups_file[x].rank(ascending=False)
players_only=players_only.drop(['Player'], axis=1)
salary_2x_check = (overall_file - (salary_file*2))
salary_3x_check = (overall_file - (salary_file*3))
salary_4x_check = (overall_file - (salary_file*4))
gpp_check = (overall_file - ((salary_file*5)+10))
players_only['Average_Rank'] = players_only.mean(axis=1)
players_only['Top_finish'] = players_only[players_only == 1].count(axis=1)/total_sims
players_only['Top_5_finish'] = players_only[players_only <= 5].count(axis=1)/total_sims
players_only['Top_10_finish'] = players_only[players_only <= 10].count(axis=1)/total_sims
players_only['20+%'] = overall_file[overall_file >= 20].count(axis=1)/float(total_sims)
players_only['2x%'] = salary_2x_check[salary_2x_check >= 1].count(axis=1)/float(total_sims)
players_only['3x%'] = salary_3x_check[salary_3x_check >= 1].count(axis=1)/float(total_sims)
players_only['4x%'] = salary_4x_check[salary_4x_check >= 1].count(axis=1)/float(total_sims)
players_only['GPP%'] = gpp_check[gpp_check >= 1].count(axis=1)/float(total_sims)
players_only['Player'] = hold_file[['Player']]
final_outcomes = players_only[['Player', 'Top_finish', 'Top_5_finish', 'Top_10_finish', '20+%', '2x%', '3x%', '4x%', 'GPP%']]
final_Proj = pd_merge(hold_file, final_outcomes, on="Player")
final_Proj = final_Proj[['Player', 'Position', 'Salary', 'Floor', 'Median', 'Ceiling', 'Top_finish', 'Top_5_finish', 'Top_10_finish', '20+%', '2x%', '3x%', '4x%', 'GPP%']]
final_Proj['name_team'] = final_Proj['Player'] + final_Proj['Position']
final_Proj['Own'] = final_Proj['Player'].map(own_dict)
final_Proj['Small_Own'] = final_Proj['Player'].map(small_own_dict)
final_Proj['Large_Own'] = final_Proj['Player'].map(large_own_dict)
final_Proj['Cash_Own'] = final_Proj['Player'].map(cash_own_dict)
final_Proj['Team'] = final_Proj['name_team'].map(team_dict)
final_Proj['Opp'] = final_Proj['Player'].map(opp_dict)
final_Proj = final_Proj[['Player', 'Position', 'Team', 'Opp', 'Salary', 'Floor', 'Median', 'Ceiling', 'Top_finish', 'Top_5_finish', 'Top_10_finish', '20+%', '2x%', '3x%', '4x%', 'GPP%',
'Own', 'Small_Own', 'Large_Own', 'Cash_Own']]
final_Proj = final_Proj.sort_values(by='Median', ascending=False)
return final_Proj.copy()
def FD_MLB_ROO_Build(projections_file, floor_var, ceiling_var, std_var, distribution_type):
sp_frame = projections_file[projections_file['Position'].str.contains('P')]
hit_frame = projections_file[~projections_file['Position'].str.contains('P')]
sp_norm_var = 100 / sp_frame['Own'].sum()
sp_frame['Own'] = sp_frame['Own'] * sp_norm_var
hit_norm_var = 800 / hit_frame['Own'].sum()
hit_frame['Own'] = hit_frame['Own'] * hit_norm_var
working_roo = pd_concat([sp_frame, hit_frame])
own_dict = dict(zip(working_roo.Player, working_roo.Own))
team_dict = dict(zip(working_roo.Player, working_roo.Team))
player_id_dict = dict(zip(working_roo.Player, working_roo.player_ID))
total_sims = 1000
basic_own_df = working_roo.copy()
basic_own_df['name_team'] = basic_own_df['Player'] + basic_own_df['Position']
def calculate_ownership(df):
# Filter the dataframe based on the position
frame = df.copy()
# Calculate Small Field Own%
frame['Base Own%'] = np_where(
(frame['Own'] - frame['Own'].mean() >= 0),
frame['Own'] * (5 * (frame['Own'] - (frame['Own'].mean() / 1.5)) / 100) + frame['Own'].mean(),
frame['Own']
)
frame['Base Own%'] = np_where(
frame['Base Own%'] > 85,
85,
frame['Base Own%']
)
# Calculate Small Field Own%
frame['Small Field Own%'] = np_where(
(frame['Own'] - frame['Own'].mean() >= 0),
frame['Own'] * (6 * (frame['Own'] - frame['Own'].mean()) / 100) + frame['Own'].mean(),
frame['Own']
)
frame['Small Field Own%'] = np_where(
frame['Small Field Own%'] > 85,
85,
frame['Small Field Own%']
)
# Calculate Large Field Own%
frame['Large Field Own%'] = np_where(
(frame['Own'] - frame['Own'].mean() >= 0),
frame['Own'] * (2.5 * (frame['Own'] - frame['Own'].mean()) / 100) + frame['Own'].mean(),
frame['Own']
)
frame['Large Field Own%'] = np_where(
frame['Large Field Own%'] > 85,
85,
frame['Large Field Own%']
)
# Calculate Cash Own%
frame['Cash Own%'] = np_where(
(frame['Own'] - frame['Own'].mean() >= 0),
frame['Own'] * (8 * (frame['Own'] - frame['Own'].mean()) / 100) + frame['Own'].mean(),
frame['Own']
)
frame['Cash Own%'] = np_where(
frame['Cash Own%'] > 85,
85,
frame['Cash Own%']
)
return frame
# Apply the function to each dataframe
basic_own_df = calculate_ownership(basic_own_df)
own_norm_var_reg = 900 / basic_own_df['Own'].sum()
own_norm_var_small = 900 / basic_own_df['Small Field Own%'].sum()
own_norm_var_large = 900 / basic_own_df['Large Field Own%'].sum()
own_norm_var_cash = 900 / basic_own_df['Cash Own%'].sum()
basic_own_df['Own'] = basic_own_df['Own'] * own_norm_var_reg
basic_own_df['Small_Own'] = basic_own_df['Small Field Own%'] * own_norm_var_small
basic_own_df['Large_Own'] = basic_own_df['Large Field Own%'] * own_norm_var_large
basic_own_df['Cash_Own'] = basic_own_df['Cash Own%'] * own_norm_var_cash
basic_own_df['Own'] = np_where(basic_own_df['Own'] > 90, 90, basic_own_df['Own'])
# Apply the function to each dataframe
basic_own_df = calculate_ownership(basic_own_df)
own_norm_var_reg = 900 / basic_own_df['Own'].sum()
own_norm_var_small = 900 / basic_own_df['Small Field Own%'].sum()
own_norm_var_large = 900 / basic_own_df['Large Field Own%'].sum()
own_norm_var_cash = 900 / basic_own_df['Cash Own%'].sum()
basic_own_df['Own'] = basic_own_df['Own'] * own_norm_var_reg
basic_own_df['Small_Own'] = basic_own_df['Small Field Own%'] * own_norm_var_small
basic_own_df['Large_Own'] = basic_own_df['Large Field Own%'] * own_norm_var_large
basic_own_df['Cash_Own'] = basic_own_df['Cash Own%'] * own_norm_var_cash
own_dict = dict(zip(basic_own_df.Player, basic_own_df.Own))
small_own_dict = dict(zip(basic_own_df.Player, basic_own_df['Small Field Own%']))
large_own_dict = dict(zip(basic_own_df.Player, basic_own_df['Large Field Own%']))
cash_own_dict = dict(zip(basic_own_df.Player, basic_own_df['Cash Own%']))
team_dict = dict(zip(basic_own_df.name_team, basic_own_df.Team))
opp_dict = dict(zip(basic_own_df.Player, basic_own_df.Opp))
flex_file = basic_own_df[['Player', 'Position', 'Salary', 'Median']]
flex_file = flex_file.rename(columns={"Agg": "Median"})
flex_file['Floor'] = (flex_file['Median'] * floor_var)
flex_file['Ceiling'] = flex_file['Median'] + (5 * ceiling_var)
flex_file['STD'] = (flex_file['Median'] / std_var)
flex_file = flex_file[['Player', 'Position', 'Salary', 'Floor', 'Median', 'Ceiling', 'STD']]
flex_file = flex_file.reset_index(drop=True)
hold_file = flex_file.copy()
overall_file = flex_file.copy()
salary_file = flex_file.copy()
try:
overall_floor_gpu = np_array(overall_file['Floor'])
overall_ceiling_gpu = np_array(overall_file['Ceiling'])
overall_median_gpu = np_array(overall_file['Median'])
overall_std_gpu = np_array(overall_file['STD'])
overall_salary_gpu = np_array(overall_file['Salary'])
data_shape = (len(overall_file['Player']), total_sims) # Example: 1000 rows
salary_array = np_zeros(data_shape)
sim_array = np_zeros(data_shape)
for x in range(0, total_sims):
result_gpu = overall_salary_gpu
salary_array[:, x] = result_gpu
cupy_array = salary_array
salary_file = salary_file.reset_index(drop=True)
salary_cupy = DataFrame(cupy_array, columns=list(range(0, total_sims)))
salary_check_file = pd_concat([salary_file, salary_cupy], axis=1)
except:
for x in range(0,total_sims):
salary_file[x] = salary_file['Salary']
salary_check_file = salary_file.copy()
salary_file=salary_check_file.drop(['Player', 'Position', 'Salary', 'Floor', 'Median', 'Ceiling', 'STD'], axis=1)
salary_file = salary_file.div(1000)
try:
for x in range(0, total_sims):
if distribution_type == 'normal':
# Normal distribution (existing logic)
result_gpu = np_random.normal(overall_median_gpu, overall_std_gpu)
elif distribution_type == 'poisson':
# Poisson distribution - using median as lambda
result_gpu = np_random.poisson(overall_median_gpu)
elif distribution_type == 'bimodal':
# Bimodal distribution - mixture of two normal distributions
# First peak centered at 80% of median, second at 120% of median
if np_random.random() < 0.5:
result_gpu = np_random.normal(overall_floor_gpu, overall_std_gpu)
else:
result_gpu = np_random.normal(overall_ceiling_gpu, overall_std_gpu)
else:
raise ValueError("Invalid distribution type. Must be 'normal', 'poisson', or 'bimodal'")
sim_array[:, x] = result_gpu
add_array = sim_array
overall_file = overall_file.reset_index(drop=True)
df2 = DataFrame(add_array, columns=list(range(0, total_sims)))
check_file = pd_concat([overall_file, df2], axis=1)
except:
for x in range(0,total_sims):
if distribution_type == 'normal':
overall_file[x] = np_random.normal(overall_file['Median'], overall_file['STD'])
elif distribution_type == 'poisson':
overall_file[x] = np_random.poisson(overall_file['Median'])
elif distribution_type == 'bimodal':
# Bimodal distribution fallback
if np_random.random() < 0.5:
overall_file[x] = np_random.normal(overall_file['Median'] * 0.8, overall_file['STD'])
else:
overall_file[x] = np_random.normal(overall_file['Median'] * 1.2, overall_file['STD'])
check_file = overall_file.copy()
overall_file=check_file.drop(['Player', 'Position', 'Salary', 'Floor', 'Median', 'Ceiling', 'STD'], axis=1)
players_only = hold_file[['Player']]
raw_lineups_file = players_only
for x in range(0,total_sims):
maps_dict = {'proj_map':dict(zip(hold_file.Player,overall_file[x]))}
raw_lineups_file[x] = sum([raw_lineups_file['Player'].map(maps_dict['proj_map'])])
players_only[x] = raw_lineups_file[x].rank(ascending=False)
players_only=players_only.drop(['Player'], axis=1)
salary_2x_check = (overall_file - (salary_file*2))
salary_3x_check = (overall_file - (salary_file*3))
salary_4x_check = (overall_file - (salary_file*4))
gpp_check = (overall_file - ((salary_file*5)+10))
players_only['Average_Rank'] = players_only.mean(axis=1)
players_only['Top_finish'] = players_only[players_only == 1].count(axis=1)/total_sims
players_only['Top_5_finish'] = players_only[players_only <= 5].count(axis=1)/total_sims
players_only['Top_10_finish'] = players_only[players_only <= 10].count(axis=1)/total_sims
players_only['20+%'] = overall_file[overall_file >= 20].count(axis=1)/float(total_sims)
players_only['2x%'] = salary_2x_check[salary_2x_check >= 1].count(axis=1)/float(total_sims)
players_only['3x%'] = salary_3x_check[salary_3x_check >= 1].count(axis=1)/float(total_sims)
players_only['4x%'] = salary_4x_check[salary_4x_check >= 1].count(axis=1)/float(total_sims)
players_only['GPP%'] = gpp_check[gpp_check >= 1].count(axis=1)/float(total_sims)
players_only['Player'] = hold_file[['Player']]
final_outcomes = players_only[['Player', 'Top_finish', 'Top_5_finish', 'Top_10_finish', '20+%', '2x%', '3x%', '4x%', 'GPP%']]
final_Proj = pd_merge(hold_file, final_outcomes, on="Player")
final_Proj = final_Proj[['Player', 'Position', 'Salary', 'Floor', 'Median', 'Ceiling', 'Top_finish', 'Top_5_finish', 'Top_10_finish', '20+%', '2x%', '3x%', '4x%', 'GPP%']]
final_Proj['name_team'] = final_Proj['Player'] + final_Proj['Position']
final_Proj['Own'] = final_Proj['Player'].map(own_dict)
final_Proj['Small_Own'] = final_Proj['Player'].map(small_own_dict)
final_Proj['Large_Own'] = final_Proj['Player'].map(large_own_dict)
final_Proj['Cash_Own'] = final_Proj['Player'].map(cash_own_dict)
final_Proj['Team'] = final_Proj['name_team'].map(team_dict)
final_Proj['Opp'] = final_Proj['Player'].map(opp_dict)
final_Proj = final_Proj[['Player', 'Position', 'Team', 'Opp', 'Salary', 'Floor', 'Median', 'Ceiling', 'Top_finish', 'Top_5_finish', 'Top_10_finish', '20+%', '2x%', '3x%', '4x%', 'GPP%',
'Own', 'Small_Own', 'Large_Own', 'Cash_Own']]
final_Proj['Salary'] = final_Proj['Salary'].astype(int)
final_Proj = final_Proj.sort_values(by='Median', ascending=False)
return final_Proj.copy() |