How to drop duplicates but keep the relationship.
In my case I have duplicates inside Stock, but no duplicates inside Code.
import pandas as pd
df = pd.DataFrame({'Code' : ['NSPWRUTBL1','NSPWRUTBL2','NSPWRUTBL3','NSPWRUTPK1','NSPWRUTPK2','NSPWRUTPK3'],
'Stock' : ['890353-336','890353-336','890353-336','890353-850','890353-850','890353-850']})
print(df.drop_duplicates())
Actual Output :
Code Stock
0 NSPWRUTBL1 890353-336
1 NSPWRUTBL2 890353-336
2 NSPWRUTBL3 890353-336
3 NSPWRUTPK1 890353-850
4 NSPWRUTPK2 890353-850
5 NSPWRUTPK3 890353-850
I'm expecting to get one instance something like :
0 NSPWRUTBL1 890353-336
3 NSPWRUTPK1 890353-850