Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -48,14 +48,14 @@ def init_baselines():
|
|
| 48 |
except ValueError:
|
| 49 |
pass # Ignore columns that cannot be converted
|
| 50 |
|
| 51 |
-
qb_frame = qb_frame.sort_values(by='
|
| 52 |
|
| 53 |
worksheet = sh.worksheet('RB')
|
| 54 |
all_values = worksheet.get_all_values()
|
| 55 |
cell_vals = [row[0:11] for row in all_values[2:500]]
|
| 56 |
frame_hold = pd.DataFrame(cell_vals, columns=['Player', 'Team', 'Salary', 'OwnAvg', 'PointsAvg', 'Points per $', 'blank', 'drop', 'drop2', 'drop3', 'GPP Rank'])
|
| 57 |
frame_hold['OwnAvg'] = frame_hold['OwnAvg'].str.replace('%', '').astype(float)/100
|
| 58 |
-
rb_frame = frame_hold[['Player', 'Team', 'Salary', 'OwnAvg', 'PointsAvg', 'Points per $']]
|
| 59 |
string_cols = ['Team']
|
| 60 |
rb_frame = rb_frame.drop_duplicates(subset='Player')
|
| 61 |
rb_frame = rb_frame.set_index('Player')
|
|
@@ -67,14 +67,14 @@ def init_baselines():
|
|
| 67 |
except ValueError:
|
| 68 |
pass # Ignore columns that cannot be converted
|
| 69 |
|
| 70 |
-
rb_frame = rb_frame.sort_values(by='
|
| 71 |
|
| 72 |
worksheet = sh.worksheet('WR')
|
| 73 |
all_values = worksheet.get_all_values()
|
| 74 |
cell_vals = [row[0:11] for row in all_values[2:500]]
|
| 75 |
frame_hold = pd.DataFrame(cell_vals, columns=['Player', 'Team', 'Salary', 'OwnAvg', 'PointsAvg', 'Points per $', 'blank', 'drop', 'drop2', 'drop3', 'GPP Rank'])
|
| 76 |
frame_hold['OwnAvg'] = frame_hold['OwnAvg'].str.replace('%', '').astype(float)/100
|
| 77 |
-
wr_frame = frame_hold[['Player', 'Team', 'Salary', 'OwnAvg', 'PointsAvg', 'Points per $']]
|
| 78 |
string_cols = ['Team']
|
| 79 |
wr_frame = wr_frame.drop_duplicates(subset='Player')
|
| 80 |
wr_frame = wr_frame.set_index('Player')
|
|
@@ -86,14 +86,14 @@ def init_baselines():
|
|
| 86 |
except ValueError:
|
| 87 |
pass # Ignore columns that cannot be converted
|
| 88 |
|
| 89 |
-
wr_frame = wr_frame.sort_values(by='
|
| 90 |
|
| 91 |
worksheet = sh.worksheet('Flex')
|
| 92 |
all_values = worksheet.get_all_values()
|
| 93 |
cell_vals = [row[0:11] for row in all_values[2:500]]
|
| 94 |
frame_hold = pd.DataFrame(cell_vals, columns=['Player', 'Team', 'Salary', 'OwnAvg', 'PointsAvg', 'Points per $', 'blank', 'drop', 'drop2', 'drop3', 'GPP Rank'])
|
| 95 |
frame_hold['OwnAvg'] = frame_hold['OwnAvg'].str.replace('%', '').astype(float)/100
|
| 96 |
-
flex_frame = frame_hold[['Player', 'Team', 'Salary', 'OwnAvg', 'PointsAvg', 'Points per $']]
|
| 97 |
string_cols = ['Team']
|
| 98 |
flex_frame = flex_frame.drop_duplicates(subset='Player')
|
| 99 |
flex_frame = flex_frame.set_index('Player')
|
|
@@ -105,7 +105,7 @@ def init_baselines():
|
|
| 105 |
except ValueError:
|
| 106 |
pass # Ignore columns that cannot be converted
|
| 107 |
|
| 108 |
-
flex_frame = flex_frame.sort_values(by='
|
| 109 |
|
| 110 |
return qb_frame, rb_frame, wr_frame, flex_frame
|
| 111 |
|
|
|
|
| 48 |
except ValueError:
|
| 49 |
pass # Ignore columns that cannot be converted
|
| 50 |
|
| 51 |
+
qb_frame = qb_frame.sort_values(by='GPP Rank', ascending=False)
|
| 52 |
|
| 53 |
worksheet = sh.worksheet('RB')
|
| 54 |
all_values = worksheet.get_all_values()
|
| 55 |
cell_vals = [row[0:11] for row in all_values[2:500]]
|
| 56 |
frame_hold = pd.DataFrame(cell_vals, columns=['Player', 'Team', 'Salary', 'OwnAvg', 'PointsAvg', 'Points per $', 'blank', 'drop', 'drop2', 'drop3', 'GPP Rank'])
|
| 57 |
frame_hold['OwnAvg'] = frame_hold['OwnAvg'].str.replace('%', '').astype(float)/100
|
| 58 |
+
rb_frame = frame_hold[['Player', 'Team', 'Salary', 'OwnAvg', 'PointsAvg', 'Points per $', 'GPP Rank']]
|
| 59 |
string_cols = ['Team']
|
| 60 |
rb_frame = rb_frame.drop_duplicates(subset='Player')
|
| 61 |
rb_frame = rb_frame.set_index('Player')
|
|
|
|
| 67 |
except ValueError:
|
| 68 |
pass # Ignore columns that cannot be converted
|
| 69 |
|
| 70 |
+
rb_frame = rb_frame.sort_values(by='GPP Rank', ascending=False)
|
| 71 |
|
| 72 |
worksheet = sh.worksheet('WR')
|
| 73 |
all_values = worksheet.get_all_values()
|
| 74 |
cell_vals = [row[0:11] for row in all_values[2:500]]
|
| 75 |
frame_hold = pd.DataFrame(cell_vals, columns=['Player', 'Team', 'Salary', 'OwnAvg', 'PointsAvg', 'Points per $', 'blank', 'drop', 'drop2', 'drop3', 'GPP Rank'])
|
| 76 |
frame_hold['OwnAvg'] = frame_hold['OwnAvg'].str.replace('%', '').astype(float)/100
|
| 77 |
+
wr_frame = frame_hold[['Player', 'Team', 'Salary', 'OwnAvg', 'PointsAvg', 'Points per $', 'GPP Rank']]
|
| 78 |
string_cols = ['Team']
|
| 79 |
wr_frame = wr_frame.drop_duplicates(subset='Player')
|
| 80 |
wr_frame = wr_frame.set_index('Player')
|
|
|
|
| 86 |
except ValueError:
|
| 87 |
pass # Ignore columns that cannot be converted
|
| 88 |
|
| 89 |
+
wr_frame = wr_frame.sort_values(by='GPP Rank', ascending=False)
|
| 90 |
|
| 91 |
worksheet = sh.worksheet('Flex')
|
| 92 |
all_values = worksheet.get_all_values()
|
| 93 |
cell_vals = [row[0:11] for row in all_values[2:500]]
|
| 94 |
frame_hold = pd.DataFrame(cell_vals, columns=['Player', 'Team', 'Salary', 'OwnAvg', 'PointsAvg', 'Points per $', 'blank', 'drop', 'drop2', 'drop3', 'GPP Rank'])
|
| 95 |
frame_hold['OwnAvg'] = frame_hold['OwnAvg'].str.replace('%', '').astype(float)/100
|
| 96 |
+
flex_frame = frame_hold[['Player', 'Team', 'Salary', 'OwnAvg', 'PointsAvg', 'Points per $', 'GPP Rank']]
|
| 97 |
string_cols = ['Team']
|
| 98 |
flex_frame = flex_frame.drop_duplicates(subset='Player')
|
| 99 |
flex_frame = flex_frame.set_index('Player')
|
|
|
|
| 105 |
except ValueError:
|
| 106 |
pass # Ignore columns that cannot be converted
|
| 107 |
|
| 108 |
+
flex_frame = flex_frame.sort_values(by='GPP Rank', ascending=False)
|
| 109 |
|
| 110 |
return qb_frame, rb_frame, wr_frame, flex_frame
|
| 111 |
|