I have two dataframes (df1, df2) and I would like to create a new column in df1 that indicates if there is a match in the code columns between each dataframe. The code column in df2 is made up of strings separated by a comma.
df1
Date Code
2016-01-01 LANH08
2016-01-01 LAOH07
2016-01-01 LAPH09
2016-01-01 LAQH06
2016-01-01 LARH03
df2
Date Code
2016-01-01 LANH08, LAOH07, LXA0EW, LAGRL1
2016-01-01 LAUH02, LAVH00, LAVH01, LAYH00
2016-01-01 LANH08
2016-01-01 AAH00, ABH00, XAH03
2016-01-01 ARH04, BA0BW, BMH01, DPH00
My Goal
df1
Date Code Match
2016-01-01 LANH08 Y
2016-01-01 LAOH07 Y
2016-01-01 LAPH09 N
2016-01-01 LAQH06 N
2016-01-01 LARH03 N