How to fill df with data from another df - Python I am trying to fill df with values form a different one.
The first df is:

The second df is:

I want to add the column to first df having values from the second one to receive output:




number
trans
date
value




HF01
one
sty
1


HF01
one
lut
2


-
-
-
-


HF05
five
paz
50




I came up with code:
found = []

for index, row in one.iterrows():
    for ind, rw in two.iterrows():
        if ind not in found:
            if (one.loc[index, 'number'] == two.loc[ind, 'number']) &amp; \
               (one.loc[index, 'trans'] == two.loc[ind, 'trans']) &amp; \
                    one.loc[index,'value'] =  two.loc[ind, one.loc[index, 'date']]
                    found.append(int(ind))
                    break

It works but it is extremely slow. How it should be done properly?
First answers is close, the only thing you need to do is merge both data frames using two fields. You do not need both data frames to have the same length at all
Try:
pd.merge(df1, df2, on = [&quot;number&quot;,&quot;trans&quot;], how = &quot;left&quot;)