code: def addLagForTraining(self, df, lag_df, series, autoreg, p):
      name = series + "_Lag" + str(p)
      if name in lag_df.columns:
          autoreg.mInputNames.append(name)
          return lag_df
  
      lSeries = df[series]
      lShiftedSeries = self.shift_series(lSeries, p)
      self.mDefaultValues[series] = lSeries.values[0]
  
      lShiftedEstim = self.mSplit.getEstimPart(lShiftedSeries)
      lAcceptable = self.is_not_constant(lShiftedEstim)
      if lAcceptable:
          autoreg.mInputNames.append(name)
          lag_df[name] = lShiftedSeries
          self.mLagOrigins[name] = series
      return lag_df
  
imports: import pandas
  import numpy
  from .None import Time
  from .None import Perf
  from .None import Plots
  from .None import Utils
  import time
label_desc: Use image node_id 5 for calling the cAutoRegressiveEstimator obj's underlying member method code with example usage: obj.addLagForTraining(df, lag_df, series, autoreg, p) and returns: lag_df, lag_df