code: def aggregated_relevant_items(raw_df):
      
      df = (
          raw_df[['idSegmento', 'idPlanilhaItens', 'VlUnitarioAprovado']]
          .groupby(by=['idSegmento', 'idPlanilhaItens'])
          .agg([np.mean, lambda x: np.std(x, ddof=0)])
      )
      df.columns = df.columns.droplevel(0)
      return (
          df
          .rename(columns={'<lambda>': 'std'})
      )
docs: Aggragation for calculate mean and std.