Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. id data
  2.  
  3.  
  4. 135790075 job done, pay by card 4444-5555-6666-7777
  5.  
  6. data = pd.read_csv("sample.csv")
  7. summ = data['summary']
  8. creditcards = []
  9. regex_match_index_list =[]
  10. Validcardsfound = 0
  11. regex_count = 0
  12. for i in range(2):
  13. temp = re.findall(r'(dB(?:d[ -]*?){13,16}b)',str(values[i]))
  14.  
  15. if temp:
  16. for each in temp:
  17.  
  18. regex_count = regex_count + 1
  19. if doLuhn(str(each)) is True:
  20.  
  21.  
  22. creditcards.append(each)
  23. Validcardsfound = Validcardsfound + 1
  24. regex_match_index_list.append(i)
  25. #else:
  26. # pass
  27.  
  28. elif doLuhn(str(temp)) is False:
  29. pass
  30.  
  31.  
  32.  
  33.  
  34. else:
  35. pass
  36. rows =[]
  37.  
  38.  
  39. for each in regex_match_index_list:
  40.  
  41. changed = data.iloc[each].str.replace(r'(dB(?:d[ -]*?){13,16}b)', r'(xxxx-xxxx-xxxx-xxxx')
  42. # print("Changed", changed)
  43. rows.append(changed)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement