Really struggling to get this solution. Suppose I have the dataframe below:
| SEX | ITEM | Some other column |
|---|---|---|
| M | Socks | 233 |
| M | Socks | 1 |
| M | Hat | 2 |
| F | Socks | 3 |
| F | Hat | 3 |
| F | Hat | 6 |
| F | Hat | 2 |
I would like to find the average number of occurrences of each ITEM based on the SEX group
| SEX | ITEM | Average |
|---|---|---|
| M | Socks | 0.6666 |
| M | Hat | 0.3333 |
| F | Socks | 0.25 |
| F | Hat | 0.75 |
Can anyone help me with this?