I have a dataframe like this:
df = pd.DataFrame({'isin': ['a', 'a', 'c', 'd','c', 'e', 'd','f','s','d','c','f','a'], 'fii':['ee', 'ff', 'gg', 'hh','hh','ee','gg','rr','hh','ss','gg','rr','ff'], 'buy_value':[40,80, 15, 100, 45, 90, 120, 60, 50 ,20,60,20,15]})
and another data frame
df2 = pd.DataFrame({'isin': ['c', 'a', 'd','f', 'e'], 'mcap' : ['l','s','l','m','s'], 'company':['hdfc','sbi','pnb','cb','ub']})
I need to create a new data frame with column header as unique 'fii', 'mcap', 'company' while row header as unique 'isin'. Values inside data frame should be sum of buy_value (in case isin and fii combination repeats).
Kindly help.