Say I have a df:
df=pd.DataFrame(columns=['a','b','c','d'], data=[[2, 1,1, 3],
[4, 2,3, 7],
[2, 4,7, 9],
[3, 2,9, 11],
[4, 3,11,15],
[5, 5,15,20],
[10,3,20,30]])
and i have an array of values (consists of some values from 'c', but can be of arbitrary length)
cuts=[3,11]
Is there a way to groupby by 'c', in 3 groups, so that in
1st there were values 'c'<3,
2nd there were values 3<= 'c' <11,
3rd there were values 'c'>11 ?
and then .apply('a':'sum','b':'max', 'd':'max')
One way would be to make a dict, and then map df['c'] apply a map. But I wonder if one can do that with groupby (faster).