【发布时间】:2021-06-08 07:45:55
【问题描述】:
输入:
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'])
输出:
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'])
我想在 Python 3.6 中为每个代理 id 和 call_id 将 TASK_desc 与 df1 上的“和”合并
【问题讨论】:
标签: python python-3.x pandas