Spaces:
Sleeping
Sleeping
James McCool commited on
Commit ·
81c5c0f
1
Parent(s): e40bf7b
Add player position count displays in Streamlit app to enhance player ranking insights
Browse files- src/streamlit_app.py +15 -0
src/streamlit_app.py
CHANGED
|
@@ -458,10 +458,25 @@ def main():
|
|
| 458 |
final_df.insert(1, 'new_name', final_df['pos_des'].map(pos_des_dict))
|
| 459 |
|
| 460 |
final_df = final_df.drop(columns=['pos_rank', 'pos_des', 'pos_rank_init'], axis=1)
|
|
|
|
| 461 |
|
| 462 |
# Display results
|
| 463 |
st.header("Player Rankings")
|
| 464 |
st.dataframe(final_df, use_container_width=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 465 |
|
| 466 |
# Position breakdown
|
| 467 |
st.header("Position Breakdown")
|
|
|
|
| 458 |
final_df.insert(1, 'new_name', final_df['pos_des'].map(pos_des_dict))
|
| 459 |
|
| 460 |
final_df = final_df.drop(columns=['pos_rank', 'pos_des', 'pos_rank_init'], axis=1)
|
| 461 |
+
final_df = final_df.reset_index(drop=True)
|
| 462 |
|
| 463 |
# Display results
|
| 464 |
st.header("Player Rankings")
|
| 465 |
st.dataframe(final_df, use_container_width=True)
|
| 466 |
+
qb_count_col, rb_count_col, wr_count_col, te_count_col = st.columns(4)
|
| 467 |
+
with qb_count_col:
|
| 468 |
+
st.subheader("QB Counts")
|
| 469 |
+
st.write(f"Total QB top 12: {final_df.loc[0:11, 'Pos'] == 'QB'.sum()}")
|
| 470 |
+
with rb_count_col:
|
| 471 |
+
st.subheader("RB Counts")
|
| 472 |
+
st.write(f"Total RB top 12: {final_df.loc[0:11, 'Pos'] == 'RB'.sum()}")
|
| 473 |
+
with wr_count_col:
|
| 474 |
+
st.subheader("WR Counts")
|
| 475 |
+
st.write(f"Total WR top 12: {final_df.loc[0:11, 'Pos'] == 'WR'.sum()}")
|
| 476 |
+
with te_count_col:
|
| 477 |
+
st.subheader("TE Counts")
|
| 478 |
+
st.write(f"Total TE top 12: {final_df.loc[0:11, 'Pos'] == 'TE'.sum()}")
|
| 479 |
+
|
| 480 |
|
| 481 |
# Position breakdown
|
| 482 |
st.header("Position Breakdown")
|