Question: I have a df as follows:

```
foo bar baz
aaa 0   Laos
aaa 45  Nigeria
aaa 123 Panama
bbb 12  Panama
bbb 826 Nigeria
ccc 0   Laos
ccc 15  Laos
ccc 72  Panama
ddd 4   Panama
ddd 9   Laos
ddd 987 Panama
ddd 25  Nigeria

```

I also have a set: {"laos", "panama", "nigeria"}

I would like to groupby("foo") and only retain the groups for which column "baz" contains **all** values in the set.

So, the resulting df would contain only those lines (since bbb lacks Laos and ccc lacks Nigeria):

```
foo bar baz
aaa 0   Laos
aaa 45  Nigeria
aaa 123 Panama
ddd 4   Panama
ddd 9   Laos
ddd 987 Panama
ddd 25  Nigeria

```

Answer: 
Try with

```
s=df.groupby('foo').\
      filter(lambda x : pd.Series(["laos", "panama", "nigeria"]).isin(x['baz'].str.lower()).all())
Out[21]: 
    foo  bar      baz
0   aaa    0     Laos
1   aaa   45  Nigeria
2   aaa  123   Panama
8   ddd    4   Panama
9   ddd    9     Laos
10  ddd  987   Panama
11  ddd   25  Nigeria

```
IIUC, [`Series.str.lower`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.str.lower.html) with [`Series.isin`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.isin.html) and  [`GroupBy.transform`](https://pandas.pydata.org/pandas-docs/version/1.0.0/reference/api/pandas.core.groupby.GroupBy.transform.html)

```
l = ["laos", "panama", "nigeria"]
s = df['baz'].str.lower()

m = (s.isin(l)
      .mask(df.duplicated(['baz', 'foo']), False)
      .groupby(df['foo'])
      .transform('sum').eq(len(l)))

df_filtered = df.loc[m]
print(df_filtered)

    foo  bar      baz
0   aaa    0     Laos
1   aaa   45  Nigeria
2   aaa  123   Panama
8   ddd    4   Panama
9   ddd    9     Laos
10  ddd  987   Panama
11  ddd   25  Nigeria

```

It is similar to:

```
m = ((s.isin(l) & (~df.duplicated(['baz', 'foo'])))
       .groupby(df['foo'])
       .transform('sum').eq(len(l)))

```