I have two dataframes, one (X) with an address + a key, one (Y) with just the address. I have to loop over the addresses in dataset Y, and check if there's a matching address in dataframe X.
If there is a match, I need to grab the key so dataset Y has a matching key.
I have a working code, though it performs really slow because it loops through the whole dataset for each 250.000 times. The dataset consists of 250.000 rows so I'd like to perform a faster working method. My code looks like this:
for idx, row in Y.iterrows():
for index, row_X in X.iterrows():
if row_X['address'] == row['address']:
print('match found')