I am new to pandas and facing difficulty to get an idea, to solve this problem, can someone help me with a way to approach this.
I have a source dataframe in the below format
Here I am sharing the code to generate source dataframe:
df = pd.DataFrame({"Employee ID":[1, 2, 3, 4, 5], "Name":["A", "B", "C", "D", "E"],
"Departments":["hr", "hr, manager", "manager", "developer", "tester, manager, developer"],
"Groups":["group-1", "group-2, group-3", "", "", "group-1"]})
print(df)
I would like to convert it to the below format
I have tried with pivot table and other stackover flow example but it's not helping much, can someone help me a way to understand and solve this problem.
Thanks in advance :)