I have the following dataframe
id date other variables..
A 2019Q4
A 2020Q4
A 2021Q4
B 2018Q4
B 2019Q4
B 2020Q4
B 2021Q4
C 2020Q4
C 2021Q4
D 2021Q4
E 2018Q4
E 2019Q4
E 2020Q4
E 2021Q4
. .
I want to group by id and keep those ids if it contains all of the designated values (i.e. 2019Q4, 2020Q4, 2021Q4) then extract rows that correspond to those values. isin() won't work because it won't drop C and D.
desired output
A 2019Q4
A 2020Q4
A 2021Q4
B 2019Q4
B 2020Q4
B 2021Q4
E 2019Q4
E 2020Q4
E 2021Q4
. .