I have the following example pandas dataframe:
df = pd.DataFrame({'A': ['a1', 'a2', 'a3', 'a1', 'a2', 'a4'],
'B': ['b1', 'b1', 'b2', 'b3', 'b6', 'b6']})
I want to find the values in A that have association with all of the values of an input list in B.
For example, for an input lst = ['b1', 'b6']
, the desired output is ['a2']
. I have tried df[df['B'].isin(lst)]
from here but it is indeed not yet sufficient, or may not be even necessary.