My question is based on this one:
Apply pandas function on column only on certain rows
But I need a function that applies to the values of severals rows in one column as if those values were a list.
For example, if I select category c1 my function should apply like this: f([3,5])
| user | category | val |
| ------ | ------------------| -----|
| user 1 | c1 | 3 |
| user 1 | c2 | 4 |
| user 1 | c3 | 8 |
| user 2 | c1 | 5 |
| user 2 | c2 | 9 |
| user 2 | c3 | 10 |