You can select the numeric columns with .select_dtypes('number') [and .select_dtypes('object') for the categorical ones]:
numeric_cols = planets.select_dtypes('number').columns
P = planets.groupby(['type', 'magnetic_field'])[numeric_cols].agg(['mean', 'max'])
display(P)