James McCool commited on
Commit
fd54d3c
·
1 Parent(s): 766d3b9

Improve error handling in projections_df processing in app.py: add try-except blocks for ownership percentage conversion and salary formatting to maintain data integrity during potential conversion failures.

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -188,8 +188,15 @@ with tab1:
188
  if 'projections_df' not in st.session_state:
189
  st.session_state['projections_df'] = projections.copy()
190
 
191
- st.session_state['projections_df']['ownership'] = st.session_state['projections_df']['ownership'].str.replace('%', '').astype(float)
192
- st.session_state['projections_df']['salary'] = (st.session_state['projections_df']['salary'].astype(str).str.replace(',', '').astype(float).astype(int))
 
 
 
 
 
 
 
193
 
194
  try:
195
  name_id_map = dict(zip(
 
188
  if 'projections_df' not in st.session_state:
189
  st.session_state['projections_df'] = projections.copy()
190
 
191
+ try:
192
+ st.session_state['projections_df']['ownership'] = st.session_state['projections_df']['ownership'].str.replace('%', '').astype(float)
193
+ except:
194
+ st.session_state['projections_df']['ownership'] = st.session_state['projections_df']['ownership']
195
+
196
+ try:
197
+ st.session_state['projections_df']['salary'] = (st.session_state['projections_df']['salary'].astype(str).str.replace(',', '').astype(float).astype(int))
198
+ except:
199
+ st.session_state['projections_df']['salary'] = st.session_state['projections_df']['salary']
200
 
201
  try:
202
  name_id_map = dict(zip(