I have a Dataframe that has sales data by each sales person as shown below:
employee, product, quantity
emp_1, prod_a, 100
emp_1, prod_b, 200
emp_2, prod_a, 30
emp_4, prod_c, 400
emp_4, prod_a, 100
I have another Dataframe that have the team hierarchy
employee, manager
emp_1, emp_3
emp_2, emp_3
emp_3, emp_4
emp_4, emp_5
I am trying to create this master Dataframe that has the sales done by every employee an also maps the manager that respective employee reports to
employee, product, quantity, manager
emp_1, prod_a, 100, emp_3
emp_1, prod_b, 200, emp_3
emp_2, prod_a, 30, emp_3
emp_1, prod_a, 100, emp_4
emp_1, prod_b, 200, emp_4
emp_2, prod_a, 30, emp_4
emp_4, prod_c, 400, emp_5
emp_4, prod_a, 100, emp_5
emp_1, prod_a, 100, emp_5
emp_1, prod_b, 200, emp_5
emp_2, prod_a, 30, emp_5
Basically every manager inherits their sub-ordinates numbers and also their numbers if they sales under their name.