afortuny commited on
Commit
490594a
·
1 Parent(s): 2f98f2d

missing data handling

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -13,6 +13,12 @@ def find_matching_notes(uploaded_file, user_input):
13
  if not {'Source', 'Section', 'Notes'}.issubset(df.columns):
14
  return "The uploaded file must contain 'Source', 'Section', and 'Notes' columns."
15
 
 
 
 
 
 
 
16
  # Combine 'Notes' and 'Section' for processing
17
  df['Combined'] = df['Notes'] + ' ' + df['Section']
18
 
 
13
  if not {'Source', 'Section', 'Notes'}.issubset(df.columns):
14
  return "The uploaded file must contain 'Source', 'Section', and 'Notes' columns."
15
 
16
+ # Check for NaN values in 'Notes' and 'Section'
17
+ if df[['Notes', 'Section']].isnull().any().any():
18
+ # Optionally, drop NaN values or fill them with empty strings
19
+ df['Notes'].fillna('', inplace=True) # Replace NaN with empty string
20
+ df['Section'].fillna('', inplace=True) # Replace NaN with empty string
21
+
22
  # Combine 'Notes' and 'Section' for processing
23
  df['Combined'] = df['Notes'] + ' ' + df['Section']
24