I am importing via pyodbc 2 dataframes: df1 and df2.
They are big and I need to compare them.
PS: They don't have the same size.
3 columns size Dataframes:
What I want to do:
If CODUSU columns are equal then df2[Situação] = 'K'
What I have done, but it's too slow:
for i in range(0,len(df2)):
for k in range(0,len(df1)):
if df2.loc[i][0] == df1.loc[k][0]:
df2[i]["Situação"] = "K"
I also need to:
If in item in df1[CODUSU] and not in df2[CODUSU] then df2[Situação] = 'Q'
If in item in df2[CODUSU] and not in df1[CODUSU] then df2[Situação] = 'B'

df2.loc[df2['CODUSU'].isin(df1['CODUSU']), 'Situação'] = "K"isinis the way to go.