I have written code where I have a dataframe containing all types of food. I have then split it into fruit and veg series using str.contains. I have written code where I append any food which is common in both series to a list:
fruit = fruit_2.tolist()#converting the series to a list
veg = veg_2.tolist()#converting the series to a list
for x in range (len(fruit)):
for y in range (len(veg)):
if fruit[x] == veg[y]:
both.append(fruit[x])
print(both)
This works just wondering if someone has a solution which utilised pandas and doesn't use a for loop. Thanks