I got two dataframes, the first one is like
data = [
[11,'a',1],
[16,'b',2],
[15,'a',3],
[19,'b',4]
]
data=pd.DataFrame(data)
and the second one is like
find=[
[4,'a'],
[11,'b'],
[11,'a'],
[16,'b'],
[17,'a'],
]
find=pd.DataFrame(find)
I'd like to assign values to the second dataframe based on the first dataframe. There are few conditions need to be checked, for example: 1. if the 1st row is 4 and a, then return 1 2. if the 2nd row is 11 and b, then return 2 3. if the 3rd row is 11 and a, then return 1 2. if the 4th row is 16 and b, then return 4
I tried to write for loop to do this, but the dataset is pretty big so it takes too much time for running and in the end, it fails.
Is there any good solution for this question? Appreciate!