0

I have 2 lists of timestamps. One master list of timestamps "ideally" separated by 1 second and another searching list that does not have a defined interval between points. My issue is that there are duplicate timestamp values in my master list which means that some of the timestamps in my search list cannot be found in the master list. How do I go about finding what timestamps cannot be found in my search list? I have tried some solutions that I have found on here but nothing has yielded anything useful.

P.S. I am using numpy and pandas.

master = ['9:39:47' '9:39:48' '9:39:49' ... '14:21:10' '14:21:11' '14:21:12'] 

search = ['09:40:20' '09:40:26' '09:40:32' ... '14:20:25' '14:20:31' '14:20:37'] # 2,601 items
niraj
  • 17,498
  • 4
  • 33
  • 48
  • How are you using numpy and pandas? This seems that can be solved using set... – Dani Mesejo Dec 27 '20 at 17:43
  • Sorry I don't quite understand what's you're trying to accomplish here. Are you trying to search for missing timestamps in master list (based on search) or what is it? What is the expected result? Check this one https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples – Danail Petrov Dec 27 '20 at 17:44

2 Answers2

0

If I understand it correctly, you are looking for item in master that are not in search. Then, you can do:

not_found_in_master = [x for x in search if x not in master]
TYZ
  • 8,466
  • 5
  • 29
  • 60
0

Your question is not very clear, but if you want to figure out which values of your search list are not included in the master list, just do this:

not_included = [value for value in search if value not in master]
ljuk
  • 701
  • 3
  • 12