I have a dataframe, which I want to convert to a dictionary in such a way that col1 becomes the key and col2 becomes the value. Also, there can be multiple occurrences of a value in 1st col, in which case I want to store the counts in the form of a list corresponding to that value of col1 as key.
So basically how can I perform this conversion -
area count
10 7
10 3
10 1
20 5
30 2
30 1
40 3
{
'10' : [7,3,1],
'20' : '5',
'30' : [2,1],
'40' : 3
}
Thanks in advance!