Hi all,
I have two lists that I want to check if the values in the list called data are equal to the values in the list called data2. If they are then append 3 values next to the value found in data2 i.e. index +1,+2 and +3 in a new list.
The length of data2 is 2364004 and data is 5131.
I have tried the following code which works but takes a long time to run.
Is there a more efficient/faster way of doing this? Maybe using a numpy array function if need be or something else?
I can post the raw data if that helps
Thanks!
I have two lists that I want to check if the values in the list called data are equal to the values in the list called data2. If they are then append 3 values next to the value found in data2 i.e. index +1,+2 and +3 in a new list.
The length of data2 is 2364004 and data is 5131.
I have tried the following code which works but takes a long time to run.
1 |
data3.extend([data2[index + 1 ],data2[index + 2 ],data2[index + 3 ]]) for i in data for index, j in enumerate (data2) if i = = j |
I can post the raw data if that helps
Thanks!