James McCool commited on
Commit
901bbc5
·
1 Parent(s): 19bd3e1

Enhance salary processing in app.py: add error handling during salary conversion to integers, ensuring robustness in data processing while maintaining clarity in projections file loading.

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -140,8 +140,11 @@ 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['salary'] = projections['salary'].str.replace(',', '').str.replace('$', '').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
 
 
140
  export_projections, projections = load_file(projections_file)
141
  if projections is not None:
142
  st.success('Projections file loaded successfully!')
143
+ try:
144
+ projections['salary'] = projections['salary'].str.replace(',', '').str.replace('$', '').str.replace(' ', '').astype(int)
145
+ st.write('replaced salary symbols')
146
+ except:
147
+ pass
148
  projections = projections.apply(lambda x: x.replace(player_wrong_names_mlb, player_right_names_mlb))
149
  st.dataframe(projections.head(10))
150