My question is related to another post here How do I Pandas group-by to get sum? but it does not answer my question.
I have this dataframe:
Fruit    Name  Number
Apples   Bob    7
Apples   Bob    8
Apples   Mike   9
Apples   Steve 10
Apples   Bob    1
Oranges  Bob    2
Oranges  Tom   15
Oranges  Mike  57
Oranges  Bob   65
Oranges  Tony   1
Grapes   Bob    1
Grapes   Tom   87
Grapes   Bob   22
Grapes   Bob   12
Grapes   Tony  15
Melons   Mike  10 
I want to get a dataframe where the first column should have all the unique values from 'Fruit' column above; second column should have the sum of values from 'Number' column but only for one person, say Bob from above. If this person does not have the particular fruit, the second column should have 0. Here is the desired output:
Fruit    NumberForBob
Apples     7+8+1=16
Oranges     2+65=67
Grapes     1+22+12=35
Melons     0
I think I need to use a mix of if-statement and groupby function, but I am not able to get the desired output. How can I do this?
 
     
    