I have a dataframe like below;
ID code
333_c_132 x
333_c_132 n06
333_c_132 n36
333_c_132 n60
999_c_133 x
999_c_133 n06
999_c_133 n12
999_c_133 n24
998_c_134 x
998_c_134 n06
998_c_134 n12
998_c_134 n18
998_c_134 n36
997_c_135 x
997_c_135 n06
997_c_135 n12
997_c_135 n24
997_c_135 n36
I want to filter out the rows (unique ID) that contains both x and n36. ie
ID code
333_c_132 x
333_c_132 n36
998_c_134 x
998_c_134 n36
997_c_135 x
997_c_135 n36
I tried like this bellow;
df = df[(df.code == "x") | (df.code == "n36")]
but it returns 999_c_133 x as well.. which I want to avoid.