James McCool commited on
Commit
9693c27
·
1 Parent(s): 59693da

Update projections handling in app.py for name matching

Browse files

- Adjusted the logic to directly use the projections variable instead of session state for name matching, improving clarity and ensuring accurate data processing.
- Moved the salary data type conversion to follow the name matching operation, maintaining data integrity and enhancing code readability.

Files changed (1) hide show
  1. app.py +2 -6
app.py CHANGED
@@ -74,12 +74,8 @@ with tab1:
74
  if Contest_file and projections_file:
75
  if contest_base is not None and projections is not None:
76
  st.subheader("Name Matching functions")
77
- # Initialize projections_df in session state if it doesn't exist
78
- if 'projections_df' not in st.session_state:
79
- st.session_state['projections_df'] = projections.copy()
80
- st.session_state['projections_df']['salary'] = (st.session_state['projections_df']['salary'].astype(str).str.replace(',', '').astype(float).astype(int))
81
- # Run name matching only once when first loading the files
82
- st.session_state['Contest'], st.session_state['projections_df'], st.session_state['ownership_dict'], st.session_state['actual_dict'] = find_name_mismatches(contest_base, st.session_state['projections_df'], ownership_df, fpts_df)
83
 
84
  with tab2:
85
  if 'Contest' in st.session_state and 'projections_df' in st.session_state:
 
74
  if Contest_file and projections_file:
75
  if contest_base is not None and projections is not None:
76
  st.subheader("Name Matching functions")
77
+ st.session_state['Contest'], st.session_state['projections_df'], st.session_state['ownership_dict'], st.session_state['actual_dict'] = find_name_mismatches(contest_base, projections, ownership_df, fpts_df)
78
+ st.session_state['projections_df']['salary'] = (st.session_state['projections_df']['salary'].astype(str).str.replace(',', '').astype(float).astype(int))
 
 
 
 
79
 
80
  with tab2:
81
  if 'Contest' in st.session_state and 'projections_df' in st.session_state: