code: def rolling_lr(df, window, index: int = 0, shift: int = 0):
      """Calculate rolling scipy lin_regress() to all columns of a pandas dataframe
  
      Function can be used by ApplyFunc module.
  
      :param pd.DataFrame df: input pandas dataframe
      :param int window: size of rolling window.
      :param int index: index of lin_regress results to return. default is 0.
      :param int shift: size of shift. default is 0.
      :return: df with rolling results of lin_regress() function applied to all columns
      """
      # raw=True suppresses Future warning
      return (
          df.shift(shift)
          .rolling(window)
          .apply(
              lambda x: linregress(np.arange(len(x)), x)[index],
              raw=True,
          )
      )
  
imports: import numpy
  import pandas
  from numpy.lib.stride_tricks import as_strided
  from scipy import linalg, stats
  from scipy.stats import linregress, norm
  from popmon.analysis.hist_numpy import check_similar_hists, get_consistent_numpy_2dgrids, get_consistent_numpy_entries, set_2dgrid
  from popmon.hist.hist_utils import COMMON_HIST_TYPES, is_numeric
  from popmon.stats.numpy import probability_distribution_mean_covariance
label_desc: Use image node_id 8 for calling a global function with example usage: rolling_lr(df, window, index, shift) and returns: df