Input:
df1 = pd.DataFrame([[101, 'DC1', 'QA,DEMO'],
[101, 'EM5', 'QA,DEMO'],
[102, 'RA6', 'PA,QA,GF'],
[103, 'DC1', 'AB,LK'],
[103, 'RA6', 'OO'],
[103, 'PA4', 'AB,OO']
]
, columns=['Call_id', 'Agent_id', 'Task_code'])
df2 = pd.DataFrame([['QA', 'Enter phone number'],
['DEMO', 'ASK EMAIL ID'],
['PA', 'make notes'],
['GF', 'take call back'],
['AB', 'Apply bell mark'],
['LK', 'call Low markets'],
['OO','Out of order']
]
, columns=['Task_code', 'Task_Desc'])
output:
df = pd.DataFrame([[101, 'DC1', 'QA,DEMO','Enter phone number and ASK EMAIL ID'],
[101, 'EM5', 'QA,DEMO','Enter phone number and ASK EMAIL ID'],
[102, 'RA6', 'PA,QA,GF','make notes and Enter phone number and take call back'],
[103, 'DC1', 'AB,LK','Apply bell mark and call Low markets'],
[103, 'RA6', 'OO','Out of order'],
[103, 'PA4', 'AB,OO','Apply bell mark and Out of order']
]
, columns=['Call_id', 'Agent_id', 'Task_code','Task_desc'])
I want to merge the TASK_desc with 'and' on df1 for each agent id and call_id in Python 3.6