I've got a numpy array of strings (str8192) where the second column is the names of things. For the sake of this lets say this array is called thingList. I have two strings, string1 and string2. I'm trying to get a list of every item in the second column of thingList that is in string1 or in string 2. Currently I have this running with a for loop, but I was hoping there was a faster way I don't know about, I'm pretty new to programming.
Once I find a match, I also want to record what is in the first column but the same row as the match.
Any help to speed this is greatly appreciated, as thingList is pretty large and this functions is run quite a lot with various arrays.
tempThing = []
tempCode = []
for i in range(thingList.shape[0]):
if thingList[i][1].lower() in string1.lower() or thingList[i] [1].lower() in string2.lower():
tempThing.append(thingList[i][1])
tempCode.append(thingList[i][0])
This code works fine, but it definitely is the bottleneck in my program and is slowing it down a lot.