Multichem commited on
Commit
e6b4d5e
·
verified ·
1 Parent(s): 58264a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -12
app.py CHANGED
@@ -132,11 +132,12 @@ with tab1:
132
  DK_seed_parse = DK_seed_parse[DK_seed_parse['Team_count'].isin(stack_var2)]
133
  data_export_display = DK_seed_parse.head(1000)
134
  st.session_state.data_export_display = data_export_display.copy()
135
- st.session_state.data_export = data_export_display.copy()
136
- st.session_state.data_export_freq = pd.DataFrame(np.column_stack(np.unique(st.session_state.data_export_display.iloc[:,0:9].values, return_counts=True)),
 
137
  columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
138
  st.session_state.data_export_freq['Freq'] = st.session_state.data_export_freq['Freq'].astype(int)
139
- st.session_state.data_export_freq['Exposure'] = st.session_state.data_export_freq['Freq']/(len(DK_seed_parse['Team']))
140
 
141
  if 'data_export' in st.session_state:
142
  st.download_button(
@@ -146,23 +147,24 @@ with tab1:
146
  mime='text/csv',
147
  )
148
  with st.container():
149
- if 'data_export_display' in st.session_state:
150
  st.dataframe(st.session_state.data_export_display.style.format(precision=2), height=500, use_container_width=True)
151
  with st.container():
152
- if 'data_export_freq' in st.session_state:
153
  st.dataframe(st.session_state.data_export_freq.style.format(percentages_format, precision=2), height=500, use_container_width=True)
154
 
155
  elif site_var1 == 'Fanduel':
156
- FD_seed = init_DK_seed_frame()
157
  FD_seed_parse = FD_seed[FD_seed['Team'].isin(team_var2)]
158
  FD_seed_parse = FD_seed_parse[FD_seed_parse['Team_count'].isin(stack_var2)]
159
- data_export_display = DK_seed_parse.head(1000)
160
  st.session_state.data_export_display = data_export_display.copy()
161
- st.session_state.data_export = data_export_display.copy()
162
- st.session_state.data_export_freq = pd.DataFrame(np.column_stack(np.unique(st.session_state.data_export_display.iloc[:,0:8].values, return_counts=True)),
 
163
  columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
164
  st.session_state.data_export_freq['Freq'] = st.session_state.data_export_freq['Freq'].astype(int)
165
- st.session_state.data_export_freq['Exposure'] = st.session_state.data_export_freq['Freq']/(len(DK_seed_parse['Team']))
166
 
167
  if 'data_export' in st.session_state:
168
  st.download_button(
@@ -172,10 +174,10 @@ with tab1:
172
  mime='text/csv',
173
  )
174
  with st.container():
175
- if 'data_export_display' in st.session_state:
176
  st.dataframe(st.session_state.data_export_display.style.format(precision=2), height=500, use_container_width=True)
177
  with st.container():
178
- if 'data_export_freq' in st.session_state:
179
  st.dataframe(st.session_state.data_export_freq.style.format(percentages_format, precision=2), height=500, use_container_width=True)
180
 
181
  with tab2:
 
132
  DK_seed_parse = DK_seed_parse[DK_seed_parse['Team_count'].isin(stack_var2)]
133
  data_export_display = DK_seed_parse.head(1000)
134
  st.session_state.data_export_display = data_export_display.copy()
135
+ st.session_state.data_export_expo = DK_seed.copy()
136
+ st.session_state.data_export = DK_seed.to_parquet()
137
+ st.session_state.data_export_freq = pd.DataFrame(np.column_stack(np.unique(st.session_state.data_export_expo.iloc[:,0:9].values, return_counts=True)),
138
  columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
139
  st.session_state.data_export_freq['Freq'] = st.session_state.data_export_freq['Freq'].astype(int)
140
+ st.session_state.data_export_freq['Exposure'] = st.session_state.data_export_freq['Freq']/(len(st.session_state.data_export_expo['Team']))
141
 
142
  if 'data_export' in st.session_state:
143
  st.download_button(
 
147
  mime='text/csv',
148
  )
149
  with st.container():
150
+ if 'data_export_display' in st.session.state:
151
  st.dataframe(st.session_state.data_export_display.style.format(precision=2), height=500, use_container_width=True)
152
  with st.container():
153
+ if 'data_export_freq' in st.session.state:
154
  st.dataframe(st.session_state.data_export_freq.style.format(percentages_format, precision=2), height=500, use_container_width=True)
155
 
156
  elif site_var1 == 'Fanduel':
157
+ FD_seed = init_FD_seed_frame()
158
  FD_seed_parse = FD_seed[FD_seed['Team'].isin(team_var2)]
159
  FD_seed_parse = FD_seed_parse[FD_seed_parse['Team_count'].isin(stack_var2)]
160
+ data_export_display = FD_seed_parse.head(1000)
161
  st.session_state.data_export_display = data_export_display.copy()
162
+ st.session_state.data_export_expo = FD_seed.copy()
163
+ st.session_state.data_export = FD_seed.to_parquet()
164
+ st.session_state.data_export_freq = pd.DataFrame(np.column_stack(np.unique(st.session_state.data_export_expo.iloc[:,0:8].values, return_counts=True)),
165
  columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
166
  st.session_state.data_export_freq['Freq'] = st.session_state.data_export_freq['Freq'].astype(int)
167
+ st.session_state.data_export_freq['Exposure'] = st.session_state.data_export_freq['Freq']/(len(st.session_state.data_export_expo['Team']))
168
 
169
  if 'data_export' in st.session_state:
170
  st.download_button(
 
174
  mime='text/csv',
175
  )
176
  with st.container():
177
+ if 'data_export_display' in st.session.state:
178
  st.dataframe(st.session_state.data_export_display.style.format(precision=2), height=500, use_container_width=True)
179
  with st.container():
180
+ if 'data_export_freq' in st.session.state:
181
  st.dataframe(st.session_state.data_export_freq.style.format(percentages_format, precision=2), height=500, use_container_width=True)
182
 
183
  with tab2: