I have a dataframe one column with codes and one with the varius status as per below:
db = {'Code': ['BBBBBR7','BBBBBR7','BCCMR', 'BBLGLC7', 'BBLGLC7', 'BCCBD', 'BCCBD', 'BCHRC'],
'Status': ['OK','KO','OK', 'OK', 'YES', 'PASS', 'PASS', 'OK']
}
df = pd.DataFrame(db)
I would like to keep only values where there is a duplicated in the first column and where the status is OK but output both duplicated codes, the OK status and the other associated status.
Expected output:

