I have a dataset that is employee's history. What I want to do is map the managers ID to the job position being held by that manager.
Here is a sample of what I have:
ID Name Job_Title ManagerID ManagerName
101 Adam Sales Rep 102 Ben
102 Ben Sales Supervisor 105 Chris
103 David Sales Rep 102 Ben
104 Paul Tech Manager 107 Kenny
105 Chris Sales Manager 110 Hank
What I want is to make a new column that maps ManagerID to the job they hold.
Desired Output:
ManagerID Name Mgr_Title
102 Ben Sales Supervisor
104 Paul Tech Manager
105 Chris Sales Manager
110 Hank Sales Director
I have tried getting it by using this as my code
job_table = df[['ManagerID', 'Job_Title']
mgr_job_dict = dict(job_table.values)
df['Mgr_Title'] = df['ManagerName'].map(mgr_job_dict)
What this gets me is just running through the top to bottom not actually selecting just manager jobs. Any suggestions?