Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -110,64 +110,63 @@ def convert_df_to_csv(df):
|
|
110 |
return df.to_csv().encode('utf-8')
|
111 |
|
112 |
def run_seed_frame(seed_depth1, Strength_var, strength_grow, Teams_used, Total_Runs):
|
113 |
-
|
114 |
-
seed_depth_def = seed_depth1
|
115 |
-
Strength_var_def = Strength_var
|
116 |
-
strength_grow_def = strength_grow
|
117 |
-
Teams_used_def = Teams_used
|
118 |
-
Total_Runs_def = Total_Runs
|
119 |
-
|
120 |
-
while RunsVar <= seed_depth_def:
|
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 |
return FinalPortfolio, maps_dict
|
172 |
|
173 |
def create_stack_options(player_data, wr_var):
|
|
|
110 |
return df.to_csv().encode('utf-8')
|
111 |
|
112 |
def run_seed_frame(seed_depth1, Strength_var, strength_grow, Teams_used, Total_Runs):
|
113 |
+
RunsVar = 1
|
114 |
+
seed_depth_def = seed_depth1
|
115 |
+
Strength_var_def = Strength_var
|
116 |
+
strength_grow_def = strength_grow
|
117 |
+
Teams_used_def = Teams_used
|
118 |
+
Total_Runs_def = Total_Runs
|
119 |
+
|
120 |
+
while RunsVar <= seed_depth_def:
|
121 |
+
if RunsVar <= 3:
|
122 |
+
FieldStrength = Strength_var_def
|
123 |
+
RandomPortfolio, maps_dict = get_correlated_portfolio_for_sim(Total_Runs_def * 0.1)
|
124 |
+
FinalPortfolio = RandomPortfolio
|
125 |
+
FinalPortfolio2, maps_dict2 = get_uncorrelated_portfolio_for_sim(Total_Runs_def * 0.1)
|
126 |
+
|
127 |
+
# Replace pd.concat with pl.vstack
|
128 |
+
FinalPortfolio = pl.vstack([FinalPortfolio, FinalPortfolio2])
|
129 |
+
|
130 |
+
maps_dict.update(maps_dict2)
|
131 |
+
del FinalPortfolio2
|
132 |
+
del maps_dict2
|
133 |
+
elif 3 < RunsVar <= 4:
|
134 |
+
FieldStrength += (strength_grow_def + ((30 - len(Teams_used_def)) * 0.001))
|
135 |
+
FinalPortfolio3, maps_dict3 = get_correlated_portfolio_for_sim(Total_Runs_def * 0.1)
|
136 |
+
FinalPortfolio4, maps_dict4 = get_uncorrelated_portfolio_for_sim(Total_Runs_def * 0.1)
|
137 |
+
|
138 |
+
# Replace pd.concat with pl.vstack
|
139 |
+
FinalPortfolio = pl.vstack([FinalPortfolio, FinalPortfolio3, FinalPortfolio4])
|
140 |
+
|
141 |
+
# Replace drop_duplicates and reset_index
|
142 |
+
FinalPortfolio = FinalPortfolio.drop_duplicates(subset=["Projection", "Own"]).sort("index")
|
143 |
+
|
144 |
+
maps_dict.update(maps_dict3)
|
145 |
+
maps_dict.update(maps_dict4)
|
146 |
+
del FinalPortfolio3
|
147 |
+
del maps_dict3
|
148 |
+
del FinalPortfolio4
|
149 |
+
del maps_dict4
|
150 |
+
elif RunsVar > 4:
|
151 |
+
FieldStrength = 1
|
152 |
+
FinalPortfolio3, maps_dict3 = get_correlated_portfolio_for_sim(Total_Runs_def * 0.1)
|
153 |
+
FinalPortfolio4, maps_dict4 = get_uncorrelated_portfolio_for_sim(Total_Runs_def * 0.1)
|
154 |
+
|
155 |
+
# Replace pd.concat with pl.vstack
|
156 |
+
FinalPortfolio = pl.vstack([FinalPortfolio, FinalPortfolio3, FinalPortfolio4])
|
157 |
+
|
158 |
+
# Replace drop_duplicates and reset_index
|
159 |
+
FinalPortfolio = FinalPortfolio.drop_duplicates(subset=["Projection", "Own"]).sort("index")
|
160 |
+
|
161 |
+
maps_dict.update(maps_dict3)
|
162 |
+
maps_dict.update(maps_dict4)
|
163 |
+
del FinalPortfolio3
|
164 |
+
del maps_dict3
|
165 |
+
del FinalPortfolio4
|
166 |
+
del maps_dict4
|
167 |
+
|
168 |
+
RunsVar += 1
|
169 |
|
|
|
170 |
return FinalPortfolio, maps_dict
|
171 |
|
172 |
def create_stack_options(player_data, wr_var):
|