Pandas to_dict list-like output

Viewed 65

I have a dataframe like this,

Roll No     date     status     Name
1           1/1/2020  on         A
2           1/1/2020  on         A
3           1/1/2020  on         B

I am trying to create a dictionary where key will be the names and value will be list of roll numbers, I am unable to handle the duplicate name,

my expected output is,

{
    "A" :[1,2],
    "B" :[3]
}

I can get my output by iterating the dataframe, I am looking for a pandorable way, thanks.

1 Answers
Related