Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. from collections import defaultdict
  2.  
  3. #some code goes here presumably
  4. start = time.time()
  5. sap = self.wb_sap.worksheets[0] #Sets The First Sheet in the Excel Workbook as the variable sap IN THE FUTURE THIS WILL BE MODIFIED TO BE THE SAME NUMBERED SHEET AS BEFORE
  6. wt = self.wb_wt.worksheets[1]#Sets the Trimmed Sheet in the Second Report as the var wt
  7. #This Set of Nested Loops goes through Tests for X's to T's Based on the Report - Report Comparison
  8. print(datetime.datetime.today())
  9. indexed_wt = defaultdict(list)
  10. for wtrow in wt.iter_rows():
  11. key = (wtrow[3].value, wtrow[2].value)
  12. indexed_wt[key].append(wtrow)
  13. for saprow in sap.iter_rows():
  14. key = (saprow[3].value, saprow[2].value)
  15. for wtrow in indexed_wt[key]:
  16. if wtrow[4].value in ("T","P"): #New Report Entry is Marked as T/P
  17. self.deadrows.append(wtrow)
  18. if saprow[4].value is "X": #Old Report Entry is Marked as X
  19. self.XT += 1#Increment X->Ts Counts
  20. else:
  21. self.TT += 1#Increment T->T Count
  22.  
  23. #uhhhhh. Not sure where these should go, since we deleted the `if` they used to connect to.
  24. #elif wtrow[4].value in ("T","P"):
  25. # self.deadrows.append(wtrow)
  26. #elif wtrow not in self.deadrows:
  27. # self.goodrows.append(wtrow)
  28.  
  29. print("Timing: ", endtime-start)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement