I am trying to compare two excel files using pandas & numpy - the comparable values are IP Addresses. Both excel files have columns with IP Addresses. How would I go about checking if they match and if they don't add the row to the first excel file/dataframe?
#create dataframes with the excel files
df1 = pd.read_excel(excel1)
df2 = pd.read_csv(excel2)
df1.insert(21, 'In R7', '')
#fill in empty IP values so they can be compared
df2['IP Address']=df2['IP Address'].fillna('0')
#if IP in df1 is equal to IP in df2, add yes in R7 column, if it's not already existing add to df1 and yes in R7 column
df1['In R7'] = np.where(df1['Primary IP Address'].str.contains('|'.join(df2['IP Address']), flags= re.IGNORECASE, regex = True), 'YES', '')