Wajahat698 commited on
Commit
cdde99a
·
verified ·
1 Parent(s): 853abd4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -1305,13 +1305,13 @@ def process_examples(file_name):
1305
 
1306
 
1307
  def clean_and_convert(cell):
1308
- if isinstance(cell.value, str):
1309
- cell.value = cell.value.replace("\t", "")
1310
  try:
1311
- float_val = float(cell.value)
1312
- cell.value = float_val
1313
  except (ValueError, TypeError):
1314
- pass
1315
 
1316
  def clean_excel_file(file_path):
1317
  logger.info("Cleaning file...")
@@ -1332,7 +1332,7 @@ def clean_excel_file(file_path):
1332
  # Iterate through all cells in the current sheet and clean the data
1333
  for row in worksheet.iter_rows():
1334
  for cell in row:
1335
- clean_and_convert(cell)
1336
 
1337
  # Save the cleaned file to the temporary path
1338
  workbook.save(temp_file_path)
 
1305
 
1306
 
1307
  def clean_and_convert(cell):
1308
+ if isinstance(cell, str): # Check if cell value is a string
1309
+ cell = cell.replace("\t", "")
1310
  try:
1311
+ float_val = float(cell)
1312
+ return float_val
1313
  except (ValueError, TypeError):
1314
+ return cell
1315
 
1316
  def clean_excel_file(file_path):
1317
  logger.info("Cleaning file...")
 
1332
  # Iterate through all cells in the current sheet and clean the data
1333
  for row in worksheet.iter_rows():
1334
  for cell in row:
1335
+ cell.value = clean_and_convert(cell.value)
1336
 
1337
  # Save the cleaned file to the temporary path
1338
  workbook.save(temp_file_path)