I have a dataframe with lots of duplicated rows on index, like this:
olddf = pd.DataFrame(index=['MJ','MJ','MJ','BJ','KJ','KJ'],data={'name':['masdjsdf','machael jordon','mskkkadke','boris johnson', 'kim jongun', 'kkasdfl'],'age':[23,40,31,35,25,30]})
I need to get rid of the duplicate index(rows) which also don't match the dictionary
dic = {'MJ':'machael jordon', 'BJ':'boris johnson', 'KJ':'kim jongun'}.
So after the operation, the dataframe should become
newdf = pd.DataFrame(index=['MJ','BJ','KJ'],data={'name':['machael jordon','boris johnson', 'kim jongun',],'age':[40,35,25]})
Thank you...