code: def rolling_lr_zscore(df, window, shift: int = 0):
      """Calculate rolling z-score of 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 shift: size of shift. default is 0.
      :return: df with rolling z-score results of lin_regress() function applied to all columns
      """
  
      # MB 20200420: turn original df.rolling off, it doesn't accept timestamps.
      # raw=True suppresses Future warning
      # return df.shift(shift).rolling(window).apply(func, raw=True)
      def func(x):
          y = pd.Series(index=x.index, dtype=float)
          for name in x.index:
              try:
                  xv = x[name].astype(float)
                  y[name] = norm.ppf(
                      linregress(np.arange(len(xv)), xv)[3]
                  )
              except Exception:
                  y[name] = np.nan
          return y
  
      return roll(df, window=window, shift=shift).apply(func, axis=1)
  
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 9 for calling a global function with example usage: rolling_lr_zscore(df, window, shift) and returns: roll, y