Imports and getting the dataset
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
df = pd.DataFrame({'DaysExperienceTask': ['7', '8', '2', '6', '9', '3'],
'TaskType': ['Informatica', 'Spotfire', 'Python', 'Spotfire', 'Informatica', 'Powerbi'],
'User': ['Vaughad', 'Kodams', 'Sreddy', 'Kodams', 'Vaughad', 'Sreddy']})
print(df)
DaysExperienceTask TaskType User
0 7 Informatica Vaughad
1 8 Spotfire Kodams
2 2 Python Sreddy
3 6 Spotfire Kodams
4 9 Informatica Vaughad
5 3 Powerbi Sreddy
This is the result I would like to get
DaysExperienceTask TaskType User TaskCount
0 7 Informatica Vaughad 16
1 8 Spotfire Kodams 14
2 2 Python Sreddy 2
3 6 Spotfire Kodams 14
4 9 Informatica Vaughad 16
5 3 Powerbi Sreddy 3
I would like to sum the 'DaysExperienceTask' by each 'TaskType' and make
sure it corresponds to the correct 'User' and is then displayed in a new column 'TaskCount'. This should tell me how much Experience a User has with each task.
Any help is greatly appreciated! Thank you!