James McCool commited on
Commit
fb3a403
·
1 Parent(s): 8976120

Enhance data handling in load_ss_file.py by replacing zeros with NaN and dropping rows with any NaN values. This improves data integrity for CSV and Excel file imports.

Browse files
Files changed (1) hide show
  1. global_func/load_ss_file.py +3 -1
global_func/load_ss_file.py CHANGED
@@ -21,12 +21,14 @@ def load_ss_file(lineups, csv_file):
21
 
22
  if clean_name.endswith('.csv'):
23
  lineups_df = pd.read_csv(lineups)
 
24
  elif clean_name.endswith(('.xls', '.xlsx')):
25
  lineups_df = pd.read_excel(lineups)
 
26
  else:
27
  st.error('Please upload either a CSV or Excel file for lineups')
28
  return None, None
29
-
30
  export_df = lineups_df.copy()
31
 
32
  # Map the IDs to names
 
21
 
22
  if clean_name.endswith('.csv'):
23
  lineups_df = pd.read_csv(lineups)
24
+ lineups_df = lineups_df.replace(0, np.nan)
25
  elif clean_name.endswith(('.xls', '.xlsx')):
26
  lineups_df = pd.read_excel(lineups)
27
+ lineups_df = lineups_df.replace(0, np.nan)
28
  else:
29
  st.error('Please upload either a CSV or Excel file for lineups')
30
  return None, None
31
+ lineups_df = lineups_df.dropna(how='any')
32
  export_df = lineups_df.copy()
33
 
34
  # Map the IDs to names