Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -117,6 +117,7 @@ with tab3:
|
|
117 |
with df_hold_container.container():
|
118 |
|
119 |
df = pitcher_proj
|
|
|
120 |
|
121 |
total_sims = 5000
|
122 |
|
@@ -138,29 +139,31 @@ with tab3:
|
|
138 |
hold_file = flex_file
|
139 |
overall_file = flex_file
|
140 |
salary_file = flex_file
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
for x in range(0,total_sims):
|
145 |
-
overall_file[x] = np.random.normal(overall_file['Median'],overall_file['STD'])
|
146 |
-
|
147 |
-
overall_file=overall_file.drop(['Player', 'Floor', 'Median', 'Ceiling', 'STD'], axis=1)
|
148 |
overall_file.astype('int').dtypes
|
149 |
|
150 |
players_only = hold_file[['Player']]
|
|
|
151 |
|
152 |
-
|
|
|
|
|
|
|
153 |
|
154 |
-
players_only['
|
155 |
-
players_only
|
156 |
-
|
|
|
157 |
players_only['Top_finish'] = players_only[players_only == 1].count(axis=1)/total_sims
|
158 |
players_only['Top_5_finish'] = players_only[players_only <= 5].count(axis=1)/total_sims
|
159 |
players_only['Top_10_finish'] = players_only[players_only <= 10].count(axis=1)/total_sims
|
160 |
-
|
|
|
|
|
161 |
players_only['Player'] = hold_file[['Player']]
|
162 |
|
163 |
-
final_outcomes = players_only[['Player', 'Top_finish', 'Top_5_finish', 'Top_10_finish', '10%', '
|
164 |
|
165 |
final_Proj = pd.merge(hold_file, final_outcomes, on="Player")
|
166 |
final_Proj = final_Proj[['Player', 'Top_finish', 'Top_5_finish', 'Top_10_finish', '10%', 'Median', '90%']]
|
@@ -185,6 +188,7 @@ with tab4:
|
|
185 |
with df_hold_container.container():
|
186 |
|
187 |
df = pitcher_proj
|
|
|
188 |
|
189 |
total_sims = 5000
|
190 |
|
@@ -206,29 +210,31 @@ with tab4:
|
|
206 |
hold_file = flex_file
|
207 |
overall_file = flex_file
|
208 |
salary_file = flex_file
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
for x in range(0,total_sims):
|
213 |
-
overall_file[x] = np.random.normal(overall_file['Median'],overall_file['STD'])
|
214 |
-
|
215 |
-
overall_file=overall_file.drop(['Player', 'Floor', 'Median', 'Ceiling', 'STD'], axis=1)
|
216 |
overall_file.astype('int').dtypes
|
217 |
|
218 |
players_only = hold_file[['Player']]
|
|
|
219 |
|
220 |
-
|
|
|
|
|
|
|
221 |
|
222 |
-
players_only['
|
223 |
-
players_only
|
224 |
-
|
|
|
225 |
players_only['Top_finish'] = players_only[players_only == 1].count(axis=1)/total_sims
|
226 |
players_only['Top_5_finish'] = players_only[players_only <= 5].count(axis=1)/total_sims
|
227 |
players_only['Top_10_finish'] = players_only[players_only <= 10].count(axis=1)/total_sims
|
228 |
-
|
|
|
|
|
229 |
players_only['Player'] = hold_file[['Player']]
|
230 |
|
231 |
-
final_outcomes = players_only[['Player', 'Top_finish', 'Top_5_finish', 'Top_10_finish', '10%', '
|
232 |
|
233 |
final_Proj = pd.merge(hold_file, final_outcomes, on="Player")
|
234 |
final_Proj = final_Proj[['Player', 'Top_finish', 'Top_5_finish', 'Top_10_finish', '10%', 'Median', '90%']]
|
|
|
117 |
with df_hold_container.container():
|
118 |
|
119 |
df = pitcher_proj
|
120 |
+
df.rename(columns={"Name": "Player"}, inplace = True)
|
121 |
|
122 |
total_sims = 5000
|
123 |
|
|
|
139 |
hold_file = flex_file
|
140 |
overall_file = flex_file
|
141 |
salary_file = flex_file
|
142 |
+
|
143 |
+
overall_file=overall_file.drop(['Player', 'Position', 'Salary', 'Floor', 'Median', 'Ceiling', 'STD'], axis=1)
|
|
|
|
|
|
|
|
|
|
|
144 |
overall_file.astype('int').dtypes
|
145 |
|
146 |
players_only = hold_file[['Player']]
|
147 |
+
raw_lineups_file = players_only
|
148 |
|
149 |
+
for x in range(0,total_sims):
|
150 |
+
maps_dict = {'proj_map':dict(zip(hold_file.Player,overall_file[x]))}
|
151 |
+
raw_lineups_file[x] = sum([raw_lineups_file['Player'].map(maps_dict['proj_map'])])
|
152 |
+
players_only[x] = raw_lineups_file[x].rank(ascending=False)
|
153 |
|
154 |
+
players_only=players_only.drop(['Player'], axis=1)
|
155 |
+
players_only.astype('int').dtypes
|
156 |
+
|
157 |
+
players_only['Average_Rank'] = players_only.mean(axis=1)
|
158 |
players_only['Top_finish'] = players_only[players_only == 1].count(axis=1)/total_sims
|
159 |
players_only['Top_5_finish'] = players_only[players_only <= 5].count(axis=1)/total_sims
|
160 |
players_only['Top_10_finish'] = players_only[players_only <= 10].count(axis=1)/total_sims
|
161 |
+
players_only['10%'] = overall_file.quantile(0.1, axis=1)
|
162 |
+
players_only['90%'] = overall_file.quantile(0.9, axis=1)
|
163 |
+
|
164 |
players_only['Player'] = hold_file[['Player']]
|
165 |
|
166 |
+
final_outcomes = players_only[['Player', 'Top_finish', 'Top_5_finish', 'Top_10_finish', '10%', '90%']]
|
167 |
|
168 |
final_Proj = pd.merge(hold_file, final_outcomes, on="Player")
|
169 |
final_Proj = final_Proj[['Player', 'Top_finish', 'Top_5_finish', 'Top_10_finish', '10%', 'Median', '90%']]
|
|
|
188 |
with df_hold_container.container():
|
189 |
|
190 |
df = pitcher_proj
|
191 |
+
df.rename(columns={"Name": "Player"}, inplace = True)
|
192 |
|
193 |
total_sims = 5000
|
194 |
|
|
|
210 |
hold_file = flex_file
|
211 |
overall_file = flex_file
|
212 |
salary_file = flex_file
|
213 |
+
|
214 |
+
overall_file=overall_file.drop(['Player', 'Position', 'Salary', 'Floor', 'Median', 'Ceiling', 'STD'], axis=1)
|
|
|
|
|
|
|
|
|
|
|
215 |
overall_file.astype('int').dtypes
|
216 |
|
217 |
players_only = hold_file[['Player']]
|
218 |
+
raw_lineups_file = players_only
|
219 |
|
220 |
+
for x in range(0,total_sims):
|
221 |
+
maps_dict = {'proj_map':dict(zip(hold_file.Player,overall_file[x]))}
|
222 |
+
raw_lineups_file[x] = sum([raw_lineups_file['Player'].map(maps_dict['proj_map'])])
|
223 |
+
players_only[x] = raw_lineups_file[x].rank(ascending=False)
|
224 |
|
225 |
+
players_only=players_only.drop(['Player'], axis=1)
|
226 |
+
players_only.astype('int').dtypes
|
227 |
+
|
228 |
+
players_only['Average_Rank'] = players_only.mean(axis=1)
|
229 |
players_only['Top_finish'] = players_only[players_only == 1].count(axis=1)/total_sims
|
230 |
players_only['Top_5_finish'] = players_only[players_only <= 5].count(axis=1)/total_sims
|
231 |
players_only['Top_10_finish'] = players_only[players_only <= 10].count(axis=1)/total_sims
|
232 |
+
players_only['10%'] = overall_file.quantile(0.1, axis=1)
|
233 |
+
players_only['90%'] = overall_file.quantile(0.9, axis=1)
|
234 |
+
|
235 |
players_only['Player'] = hold_file[['Player']]
|
236 |
|
237 |
+
final_outcomes = players_only[['Player', 'Top_finish', 'Top_5_finish', 'Top_10_finish', '10%', '90%']]
|
238 |
|
239 |
final_Proj = pd.merge(hold_file, final_outcomes, on="Player")
|
240 |
final_Proj = final_Proj[['Player', 'Top_finish', 'Top_5_finish', 'Top_10_finish', '10%', 'Median', '90%']]
|