I have two Data frames df1
( having columns C1,C2,etc) and df2
(having columns S1,S2,etc)
I want to iterate through each column of both the Data Frames.
Currently I am doing the following thing:
df3=pd.Dataframe([])
for index1,row1 in df1.iterrows():
for index2,row2 in df2.iterrows():
if row1['C1']==row2['S1']:
#perform Some Operations on each row like:
df3 = df3.append(pd.DataFrame({'A': row2['S1'], 'B': row2['S2'],'C':functionCall(row1['c3'], row2['S3'])}, index=[0]), ignore_index=True)
This works ok but it takes too much time.
I wanted to know, Is there a more efficient way of iterating through two Data Frames?