Spaces:
Running
Running
James McCool
commited on
Commit
·
be3d85a
1
Parent(s):
d617759
step to finalize market table
Browse files
app.py
CHANGED
@@ -226,6 +226,19 @@ with tab4:
|
|
226 |
market_type = st.selectbox('Select type of prop are you wanting to view', options = prop_table_options, key = 'market_type_key')
|
227 |
disp_market = market_props.copy()
|
228 |
disp_market = disp_market[disp_market['PropType'] == market_type]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
|
230 |
st.dataframe(disp_market.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(prop_format, precision=2), height = 1000, use_container_width = True)
|
231 |
st.download_button(
|
|
|
226 |
market_type = st.selectbox('Select type of prop are you wanting to view', options = prop_table_options, key = 'market_type_key')
|
227 |
disp_market = market_props.copy()
|
228 |
disp_market = disp_market[disp_market['PropType'] == market_type]
|
229 |
+
disp_market['FANDUEL_Proj'] = disp_market.apply(lambda x: x['Projection'] if x['OddsType'] == 'FANDUEL' else None, axis=1)
|
230 |
+
disp_market['DRAFTKINGS_Proj'] = disp_market.apply(lambda x: x['Projection'] if x['OddsType'] == 'DRAFTKINGS' else None, axis=1)
|
231 |
+
disp_market['MGM_Proj'] = disp_market.apply(lambda x: x['Projection'] if x['OddsType'] == 'MGM' else None, axis=1)
|
232 |
+
disp_market['CONSENSUS_Proj'] = disp_market.apply(lambda x: x['Projection'] if x['OddsType'] == 'CONSENSUS' else None, axis=1)
|
233 |
+
|
234 |
+
# Fill forward within groups to populate projection columns
|
235 |
+
disp_market = disp_market.groupby(['Player', 'PropType']).fillna(method='ffill').fillna(method='bfill')
|
236 |
+
|
237 |
+
# Keep only one row per player/prop combination
|
238 |
+
disp_market = disp_market.drop_duplicates(subset=['Player', 'PropType'], keep='first')
|
239 |
+
|
240 |
+
# Select and order columns
|
241 |
+
disp_market = disp_market[['Player', 'Team', 'PropType', 'FANDUEL_Proj', 'DRAFTKINGS_Proj', 'MGM_Proj', 'CONSENSUS_Proj']]
|
242 |
|
243 |
st.dataframe(disp_market.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(prop_format, precision=2), height = 1000, use_container_width = True)
|
244 |
st.download_button(
|