Skip to content
Advertisement

Pandas Dataframe loop to append values to a list for each unique name

I have the following dataframe:

JavaScript

enter image description here

I would like to create a list for each unique Name and append the Value values to each list.

My expected output is:

JavaScript

Any ideas on the most efficient way to do this? thank you!

Advertisement

Answer

To aggregate as dictionary, you can use:

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement