code: def group_by_agg_lags(data):
      g = data.groupby(["store", "item"]).sales
  
      # lags older than 92 to be aple to prepare test data correctly
      for i in range(92, 366):
          data["lag_" + str(i)] = g.shift(i)
      data.dropna(inplace=True, axis=0)
  
      data["mean_last_year_week_7"] = data.iloc[:, 266:274].mean(axis=1)
      data["mean_last_year_week_6"] = data.iloc[:, 267:275].mean(axis=1)
      data["mean_last_year_week_5"] = data.iloc[:, 268:276].mean(axis=1)
      data["mean_last_year_week_4"] = data.iloc[:, 269:277].mean(axis=1)
      data["mean_last_year_week_3"] = data.iloc[:, 270:278].mean(axis=1)
      data["mean_last_year_week_2"] = data.iloc[:, 271:279].mean(axis=1)
      data["mean_last_year_week_1"] = data.iloc[:, 272:280].mean(axis=1)
      data["moving_mean_last_year_week"] = data.iloc[:, 280:287].mean(
          axis=1
      )
      data["sum_last_year_week"] = data.iloc[:, 272:280].sum(axis=1)
      return data
  
file_path: h2o-3/h2o-py/tests/testdir_algos/gbm/pyunit_PUBDEV_4076_custom_distribution_demo.py
imports: import sys
  import h2o
  from tests import pyunit_utils
  import pandas
  from h2o.estimators.gbm import H2OGradientBoostingEstimator
  from h2o.utils.distributions import CustomDistributionGaussian
label_desc: Use image node_id 2 for calling a global function with example usage: group_by_agg_lags(data) and returns: data