James McCool commited on
Commit
dbbaaf8
·
1 Parent(s): 3859c1f

Improve CSV file loading logic to ensure pricing flag is set only when a file is provided

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -761,7 +761,8 @@ if selected_tab == 'Data Load':
761
  mime="text/csv"
762
  )
763
  st.session_state['csv_file'] = load_csv(csv_file)
764
- st.session_state['pricing_loaded'] = True
 
765
  try:
766
  st.session_state['csv_file']['Salary'] = st.session_state['csv_file']['Salary'].astype(str).str.replace(',', '').astype(int)
767
  except:
@@ -788,8 +789,9 @@ if selected_tab == 'Data Load':
788
  st.session_state['csv_file']['Position'] = st.session_state['csv_file']['Position'].replace('D', 'DST', regex=False)
789
  except:
790
  pass
791
- st.success('Projections file loaded successfully!')
792
- st.dataframe(st.session_state['csv_file'].head(10))
 
793
 
794
  with col2:
795
  st.subheader("Portfolio File")
 
761
  mime="text/csv"
762
  )
763
  st.session_state['csv_file'] = load_csv(csv_file)
764
+ if csv_file is not None:
765
+ st.session_state['pricing_loaded'] = True
766
  try:
767
  st.session_state['csv_file']['Salary'] = st.session_state['csv_file']['Salary'].astype(str).str.replace(',', '').astype(int)
768
  except:
 
789
  st.session_state['csv_file']['Position'] = st.session_state['csv_file']['Position'].replace('D', 'DST', regex=False)
790
  except:
791
  pass
792
+ if st.session_state['csv_file'] is not None:
793
+ st.success('Projections file loaded successfully!')
794
+ st.dataframe(st.session_state['csv_file'].head(10))
795
 
796
  with col2:
797
  st.subheader("Portfolio File")