data = np.array([[1, -1, 20], [1, 1, 50], [1, 1, 50], [2, 0, 100]])
x = pd.DataFrame(data, columns=['name', 'value', 'value2'])
x.groupby(['name', x['value'] > 0])['value2'].sum()
Apply function to 2nd column in pandas dataframe groupby