James McCool commited on
Commit
108ace7
·
1 Parent(s): 90a4822

Enhance salary data processing in app.py: add a try-except block to convert salary values to integers after removing unwanted characters, improving data integrity during projections file handling.

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -140,6 +140,10 @@ with tab1:
140
  if projections is not None:
141
  st.success('Projections file loaded successfully!')
142
  projections = projections.apply(lambda x: x.replace(player_wrong_names_mlb, player_right_names_mlb))
 
 
 
 
143
  st.dataframe(projections.head(10))
144
 
145
  if portfolio_file and projections_file:
 
140
  if projections is not None:
141
  st.success('Projections file loaded successfully!')
142
  projections = projections.apply(lambda x: x.replace(player_wrong_names_mlb, player_right_names_mlb))
143
+ try:
144
+ projections['salary'] = projections['salary'].astype(str).str.replace([',', '$', ' '], '', regex=True).astype(int)
145
+ except:
146
+ pass
147
  st.dataframe(projections.head(10))
148
 
149
  if portfolio_file and projections_file: