I have a data frame like so
product_id view_count purchase_count
1 11 1
2 20 3
3 5 2
...
I would like to transform this into a table that groups by view_count and sums the purchase_count for an interval for instance.
view_count_range total_purchase_count
0-10 45
10-20 65
These view_count_ranges will be of fixed size. I would appreciate any suggestions on how to group ranges like this.
cutis a handy tool for this sort of thing. here’s one way:Which yields: