5m4ck3r commited on
Commit
7f0b34b
·
verified ·
1 Parent(s): 4a61018

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -3
app.py CHANGED
@@ -220,11 +220,20 @@ def swapper(i1, i2, i3):
220
  second = first_candidates[1] if second is None else second
221
  remaining_data = [i1, i2, i3]
222
  if first is None:
223
- first = remaining_data.pop(remaining_data.index(next(filter(lambda x: x not in {first, second, third}, remaining_data), None)))
 
 
 
224
  if second is None:
225
- second = remaining_data.pop(remaining_data.index(next(filter(lambda x: x not in {first, second, third}, remaining_data), None)))
 
 
 
226
  if third is None:
227
- third = remaining_data.pop(remaining_data.index(next(filter(lambda x: x not in {first, second, third}, remaining_data), None)))
 
 
 
228
 
229
  return first, second, third
230
 
@@ -588,6 +597,10 @@ def process_file(filepath: str):
588
 
589
  empty_rows = 0
590
 
 
 
 
 
591
  for row in ws.iter_rows(min_row=2, max_row=ws.max_row):
592
 
593
  if empty_rows > 3:
 
220
  second = first_candidates[1] if second is None else second
221
  remaining_data = [i1, i2, i3]
222
  if first is None:
223
+ try:
224
+ first = remaining_data.pop(remaining_data.index(next(filter(lambda x: x not in {first, second, third}, remaining_data), None)))
225
+ except:
226
+ first = i1
227
  if second is None:
228
+ try:
229
+ second = remaining_data.pop(remaining_data.index(next(filter(lambda x: x not in {first, second, third}, remaining_data), None)))
230
+ except:
231
+ second = i2
232
  if third is None:
233
+ try:
234
+ third = remaining_data.pop(remaining_data.index(next(filter(lambda x: x not in {first, second, third}, remaining_data), None)))
235
+ except:
236
+ third = i3
237
 
238
  return first, second, third
239
 
 
597
 
598
  empty_rows = 0
599
 
600
+ # for row in ws.iter_rows(min_row=2, max_row=ws.max_row):
601
+ # if any(cell.value not in (None, "") for cell in row):
602
+ # total_row += 1
603
+
604
  for row in ws.iter_rows(min_row=2, max_row=ws.max_row):
605
 
606
  if empty_rows > 3: