I have two dataframes df1['LicId'] and df2['LicId'].
df1['LicId'] will always have one value
LicId
0 abc1234
However df2['LicId'] will have several Ids
LicId
0 abc1234
1 xyz2345
My task is to compare df1['LicId'] with df2['LicId'] and execute the code only if there is a match between two.
I have tried:
if df1['LicId'][0]==df2['LicId'][0]:
remaining code
However, this will check only for abc1234 - It has to check for all the Index values of df2. Later, I may also have xyz2345 in df1.
Can someone let me know how to handle this?
if df1.LicId[0] in df2.LicId.values: ..., or just use merge:if len(df1.merge(df2)): ...