calculate the average of two columns in pandas code example Example: getting a column that corresponds to the average of two columns in pandas df_mean = df[["a", "b"]].mean()