I have two python generators. Say
1) txn_gen, yield the dictionary values like
{'id': 1,'ref_no': 4323453536, 'amt': 678.00, 'txn_date': '12-11-2019'}
.
.
.
{'id':10000000 , 'ref_no':8523118426, 'amt':98788.00, 'txn_date': '12-11-2019'}
2) acc_gen, yield the dictionary values like
{'ref_no': 4323453536, 'acc_no': 123456789, 'amt': 98789.00}
.
.
.
{'ref_no': 8523118426, 'acc_no': 123456789, 'amt': 45654567.00}
I want to loop txn_gen over acc_gen for ref_no matching. I am looping like this.
for gen1 in txn_gen:
for gen2 in acc_gen:
if gen1[1] == gen2[0]:
print(gen2)
But I am getting only one match value ie., the first match value. I am expecting millions of match values.
I want to improve the performance as I have millions of records.