James McCool commited on
Commit
b9fc1be
·
1 Parent(s): 0926bbb

Refactor salary processing in app.py: move salary character replacement to app.py for improved clarity and maintainability, ensuring consistent handling of salary values during projections file loading.

Browse files
Files changed (2) hide show
  1. app.py +2 -0
  2. global_func/load_file.py +0 -3
app.py CHANGED
@@ -140,6 +140,8 @@ with tab1:
140
  export_projections, projections = load_file(projections_file)
141
  if projections is not None:
142
  st.success('Projections file loaded successfully!')
 
 
143
  projections = projections.apply(lambda x: x.replace(player_wrong_names_mlb, player_right_names_mlb))
144
  st.dataframe(projections.head(10))
145
 
 
140
  export_projections, projections = load_file(projections_file)
141
  if projections is not None:
142
  st.success('Projections file loaded successfully!')
143
+ projections['salary'] = projections['salary'].str.replace([',', '$', ' '], '')
144
+ st.write('replaced salary symbols')
145
  projections = projections.apply(lambda x: x.replace(player_wrong_names_mlb, player_right_names_mlb))
146
  st.dataframe(projections.head(10))
147
 
global_func/load_file.py CHANGED
@@ -24,9 +24,6 @@ def load_file(upload):
24
  st.error('Please upload either a CSV or Excel file')
25
  return None, None
26
 
27
- df['salary'] = df['salary'].astype(str).str.replace([',', '$', ' '], '', regex=True)
28
- st.write('replaced salary symbols')
29
-
30
  export_df = df.copy()
31
 
32
  for col in df.columns:
 
24
  st.error('Please upload either a CSV or Excel file')
25
  return None, None
26
 
 
 
 
27
  export_df = df.copy()
28
 
29
  for col in df.columns: