python-applymap

Pandas : Concat rows of a dataframe with same index to form custom string in pairs

Pandas : Concat rows of a dataframe with same index to form custom string in pairs Question: Say I have a dataframe df = pd.DataFrame({‘colA’ : [‘ABC’, ‘JKL’, ‘STU’, ‘123’], ‘colB’ : [‘DEF’, ‘MNO’, ‘VWX’, ‘456’], ‘colC’ : [‘GHI’, ‘PQR’, ‘YZ’, ‘789’],}, index = [0,0,1,1]) colA colB colC 0 ABC DEF GHI 0 JKL MNO …

Total answers: 3