Let’s say I have a data frame with columns A1,A2,A3,…,An, where A1,A2,A3 are categorical variables and the rest are floats. I want to create a new data frame (or equivalent) with the following features:
- there is one row for each possible combination of variables A1, A2, A3
- The columns are A4,…,An
- The value in a given row-column entry is the average of that column of all the rows with that particular combination of values of A1,A2,A3.
I believe groupby([:A1, :A2, :A3])
will be used somehow but not sure how.