df calculate average of each column code example Example: python - caéculate the average based on the level of a second column in a df df.groupby('StationID')['BiasTemp'].mean()