If there are multiple grouping and aggregating columns, then the immediate result will be a DataFrame and not a Series. For instance, let's calculate more aggregations than just the mean, as was done in step 2:
>>> agg2 = employee.groupby(['RACE', 'GENDER'])['BASE_SALARY']
.agg(['mean', 'max', 'min']).astype(int)
>>> agg2
Unstacking the Gender column will result in MultiIndex columns. From here, you can keep swapping row and column levels with both the unstack and stack methods until you achieve the structure of data you desire:
>>> agg2.unstack('GENDER')