I have a pandas dataframe as such:

```
df = pandas.DataFrame( { 
    "Label" : ["A", "A", "B", "B", "C" , "C"] , 
    "Value" : [1, 9, 1, 1, 9, 9],
    "Weight" : [2, 4, 6, 8, 10, 12} )

```

I would like to group the data by 'Label' and generate 2 fields.

* The First field, 'newweight' would sum Weight if Value==1
* The Second field, 'weightvalue' would sum Weight\*Value

So I would be left with the following dataframe:

```
Label     newweight     weightvalue
 A           2               38
 B           14              14
 C           0               198

```

I have looked into the pandas groupby() function but have had trouble generating the 2 fields with it.