James McCool
commited on
Commit
·
1e6d51e
1
Parent(s):
3b3771c
Refactor name matching logic in app.py for improved clarity
Browse files- Removed conditional checks for session state before executing name matching functions, ensuring consistent execution of the name matching process.
- Streamlined the assignment of session state variables for contest, projections, ownership, and actual metrics, enhancing code readability and maintainability.
app.py
CHANGED
@@ -72,12 +72,11 @@ with tab1:
|
|
72 |
st.dataframe(st.session_state['projections_df'].head(10))
|
73 |
|
74 |
if Contest_file and projections_file:
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
st.session_state['actual_dict'] = dict(zip(st.session_state['actual_dict']['Player'], st.session_state['actual_dict']['FPTS']))
|
81 |
|
82 |
|
83 |
with tab2:
|
|
|
72 |
st.dataframe(st.session_state['projections_df'].head(10))
|
73 |
|
74 |
if Contest_file and projections_file:
|
75 |
+
st.subheader("Name Matching functions")
|
76 |
+
st.session_state['Contest'], st.session_state['projections_df'], st.session_state['ownership_dict'], st.session_state['actual_dict'] = find_name_mismatches(st.session_state['Contest'], st.session_state['projections_df'], st.session_state['ownership_dict'], st.session_state['actual_dict'])
|
77 |
+
st.session_state['projections_df']['salary'] = (st.session_state['projections_df']['salary'].astype(str).str.replace(',', '').astype(float).astype(int))
|
78 |
+
st.session_state['ownership_dict'] = dict(zip(st.session_state['ownership_dict']['Player'], st.session_state['ownership_dict']['Own']))
|
79 |
+
st.session_state['actual_dict'] = dict(zip(st.session_state['actual_dict']['Player'], st.session_state['actual_dict']['FPTS']))
|
|
|
80 |
|
81 |
|
82 |
with tab2:
|