I am having a dataframe df as follows:
ID IndentNo PO_Ref_No
1 10023 470089AB
2 10023 470089DC
3 10023
4 10024 674005TT
5 10024 674005LP
6 10024 674005TN
Objective: I want to drop the entire row against IndentNo= 10024 because it has got the PO_Ref_No for all 3 rows.
So the Resultant df would be like :
ID IndentNo PO_Ref_No
1 10023 470089AB
2 10023 470089DC
3 10023
Is there any clue on how to do the same efficiently? If I use below:
df['Flag'] = np.where(pd.isnull(df['PO_Ref_No']),1,0)
df = df.loc[df['Flag']!=1]
But this would take away ID number 3 of IndentNo 10023.
Any clue would be helpful.