Spaces:
Running
Running
James McCool
commited on
Commit
·
f956786
1
Parent(s):
4c7249e
Add reverse position mapping and display position DataFrame in 'Stack Finder' tab
Browse files- src/streamlit_app.py +4 -0
src/streamlit_app.py
CHANGED
|
@@ -224,6 +224,7 @@ if selected_tab == 'Stack Finder':
|
|
| 224 |
|
| 225 |
# Create a position dictionary mapping players to their eligible positions
|
| 226 |
pos_dict = dict(zip(raw_baselines.Player, raw_baselines.Position))
|
|
|
|
| 227 |
|
| 228 |
def is_valid_combination(combo):
|
| 229 |
# Count positions in this combination
|
|
@@ -416,6 +417,9 @@ if selected_tab == 'Stack Finder':
|
|
| 416 |
cut_var += 1
|
| 417 |
except:
|
| 418 |
cut_var += 1
|
|
|
|
|
|
|
|
|
|
| 419 |
st.session_state['display_frame'] = comb_DF
|
| 420 |
if 'display_frame' in st.session_state:
|
| 421 |
st.dataframe(st.session_state['display_frame'].style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), hide_index=True, use_container_width = True)
|
|
|
|
| 224 |
|
| 225 |
# Create a position dictionary mapping players to their eligible positions
|
| 226 |
pos_dict = dict(zip(raw_baselines.Player, raw_baselines.Position))
|
| 227 |
+
pos_reverse_dict = dict(zip(raw_baselines.Position, raw_baselines.Player))
|
| 228 |
|
| 229 |
def is_valid_combination(combo):
|
| 230 |
# Count positions in this combination
|
|
|
|
| 417 |
cut_var += 1
|
| 418 |
except:
|
| 419 |
cut_var += 1
|
| 420 |
+
|
| 421 |
+
pos_df = comb_DF.map(pos_dict)
|
| 422 |
+
print(pos_df.head(10))
|
| 423 |
st.session_state['display_frame'] = comb_DF
|
| 424 |
if 'display_frame' in st.session_state:
|
| 425 |
st.dataframe(st.session_state['display_frame'].style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), hide_index=True, use_container_width = True)
|