I have a data frame df1 with two columns 'ids' and 'names' -
ids     names
fhj56   abc
ty67s   pqr
yu34o   xyz
I have another data frame df2 which has some of the columns being -
user     values                       
1        ['fhj56','fg7uy8']
2        ['glao0','rt56yu','re23u']
3        ['fhj56','ty67s','hgjl09']
My result should give me those users from df2 whose values contains at least one of the ids from df1 and also tell which ids are responsible to put them into resultant table. Result should look like -
   user     values_responsible     names
   1        ['fhj56']              ['abc']
   3        ['fhj56','ty67s']      ['abc','pqr']
User 2 doesn't come in resultant table because none of its values exist in df1.
I was trying to do it as follows -
df2.query('values in @df1.ids')
But this doesn't seem to work well.
 
     
     
    