I have below data:
year code value
2003 A 12
2003 B 11
2003 C 12
2004 A 14
2004 B 15
2004 C 13
2004 E 16
2005 A 9
2005 B 18
2005 C 16
2005 F 8
2005 G 19
I WANT TO RETAIN ONLY THOSE CODES THAT ARE PRESENT FOR EVERY YEAR.
From the above dataframe I need to extract all the rows that have codes appear in the years (2003, 2004, 2005). Which means I should have a new df with 9 rows for codes A, B and C. I tried using groupby and isin() but unable to get exactly what I need.