code: def expand(df, shift: int = 1):
      """Implementation of expanding window that can handle non-numerical values such as histograms
  
      Split up input array into expanding sub-arrays
  
      :param pd.DataFrame df: input dataframe to apply rolling function to.
      :param int shift: shift of dataframe, default is 1 (optional)
      :param fillvalue: default value to fill dataframe in case shift > 0 (optional)
      """
      assert shift >= 0
      assert isinstance(
          df, (pd.DataFrame, pd.Series)
      ), "input should be a dataframe or series"
  
      cols = df.columns if isinstance(df, pd.DataFrame) else [df.name]
      x = df.values
      arr = [x[: max(i + 1 - shift, 0)] for i in range(x.shape[0])]
  
      # fill up missing values b/c off shift with Nones
      fill_value = np.array([[None] * len(cols)])
      for i in range(shift):
          arr[i] = fill_value
  
      # reshape to new data frame
      def reshape(vs, i):
          return vs if len(vs.shape) == 1 else vs[:, i]
  
      d = [
          {c: reshape(vals, i) for i, c in enumerate(cols)}
          for vals in arr
      ]
      expanded_df = pd.DataFrame(data=d, index=df.index)
  
      return expanded_df
  
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 11 for calling a global function with example usage: expand(df, shift) and returns: expanded_df, unknown