James McCool commited on
Commit
638ac79
·
1 Parent(s): 202305b

Update CSV file handling in Data Load tab

Browse files

Refactored the assignment of the CSV file from the Paydirt DB to store it in session state. This change ensures that the CSV file is correctly loaded and managed within the application, enhancing data processing and user experience.

Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -600,7 +600,7 @@ if selected_tab == 'Data Load':
600
  upload_csv_col, csv_template_col = st.columns([3, 1])
601
  if pricing_source == 'Paydirt DB':
602
  if st.button("Load from Paydirt DB"):
603
- csv_file = nfl_reg_salaries
604
  if 'csv_file' in st.session_state:
605
  del st.session_state['csv_file']
606
  else:
@@ -620,7 +620,7 @@ if selected_tab == 'Data Load':
620
  file_name="csv_template.csv",
621
  mime="text/csv"
622
  )
623
- st.session_state['csv_file'] = load_csv(csv_file)
624
  st.session_state['pricing_loaded'] = True
625
  try:
626
  st.session_state['csv_file']['Salary'] = st.session_state['csv_file']['Salary'].astype(str).str.replace(',', '').astype(int)
 
600
  upload_csv_col, csv_template_col = st.columns([3, 1])
601
  if pricing_source == 'Paydirt DB':
602
  if st.button("Load from Paydirt DB"):
603
+ st.session_state['csv_file'] = load_csv(nfl_reg_salaries)
604
  if 'csv_file' in st.session_state:
605
  del st.session_state['csv_file']
606
  else:
 
620
  file_name="csv_template.csv",
621
  mime="text/csv"
622
  )
623
+ st.session_state['csv_file'] = load_csv(csv_file)
624
  st.session_state['pricing_loaded'] = True
625
  try:
626
  st.session_state['csv_file']['Salary'] = st.session_state['csv_file']['Salary'].astype(str).str.replace(',', '').astype(int)