For pandas agg
, is there a way to specify the aggregation function based on the data type? For example, all columns of type object get "first", all floats get "mean", and so on? So as to avoid having to type out all the columns with their respective aggregating functions.
Sample data:
import seaborn as sns
iris = sns.load_dataset('iris')
Desired code:
iris.agg({"object":"first", "float":"mean"})