code: def compute_min_changepoint_index_distance(
      df, time_col, n_changepoints, min_distance_between_changepoints
  ):
      """Computes the minimal index distance between two consecutive detected change points.
  
      Given a df, its time column, the number of change points that are evenly distributed,
      and the min_distance_between_changepoints in `DateOffset, Timedelta or str`, gets the
      min distance between change point indices.
  
      Parameters
      ----------
      df : `pandas.DataFrame`
          The dataframe that has a time column.
      time_col : `str`
          The column name of time in ``df``.
      n_changepoints : `int`
          Number of change points that are uniformly placed over the time period.
      min_distance_between_changepoints : `DateOffset`, `Timedelta` or `str`
          The minimal distance that is allowed between two detected change points.
          Note: maximal unit is 'D', i.e., you may only use units no more than 'D' such as
          '10D', '5H', '100T', '200S'. The reason is that 'W', 'M' or higher has either
          cycles or indefinite number of days, thus is not parsable by pandas as timedelta.
  
      Returns
      -------
      min_changepoint_index_distance : `int`
          The minimal index distance that is allowed between two detected change points.
      """
      if n_changepoints == 0:
          return df.shape[0]
      check_freq_unit_at_most_day(
          min_distance_between_changepoints,
          "min_distance_between_changepoints",
      )
      # `to_offset` function handles string frequency without numbers such as 'D' instead of '1D',
      # so we use `to_offset` here rather than `to_timedelta`.
      min_dist = to_offset(min_distance_between_changepoints)
      # There are `n_changepoints` change points and 1 growth term, so there is `n_changepoints` gaps
      # Therefore the following is divided by `n_changepoints`
      try:
          changepoint_dist = (
              df[time_col].iloc[-1] - df[time_col].iloc[0]
          ) / n_changepoints
      except TypeError:
          changepoint_dist = (
              pd.to_datetime(df[time_col].iloc[-1])
              - pd.to_datetime(df[time_col].iloc[0])
          ) / n_changepoints
      return int(
          np.ceil(
              min_dist.delta.total_seconds()
              / changepoint_dist.total_seconds()
          )
      )
  
imports: import warnings
  from datetime import timedelta
  import numpy
  import pandas
  import plotly.graph_objects
  from pandas.plotting import register_matplotlib_converters
  from pandas.tseries.frequencies import to_offset
  from sklearn.linear_model import Lasso
  from sklearn.linear_model import LassoCV
  from sklearn.linear_model import LinearRegression
  from sklearn.linear_model import RidgeCV
  from greykite.common.constants import CHANGEPOINT_COL_PREFIX
  from greykite.common.constants import TimeFeaturesEnum
  from greykite.common.features.timeseries_features import add_time_features_df
  from greykite.common.features.timeseries_features import build_time_features_df
  from greykite.common.features.timeseries_features import fourier_series_multi_fcn
  from greykite.common.features.timeseries_features import get_changepoint_dates_from_changepoints_dict
  from greykite.common.features.timeseries_features import get_changepoint_features
  from greykite.common.features.timeseries_features import get_changepoint_features_and_values_from_config
  from greykite.common.features.timeseries_features import get_default_origin_for_time_vars
  from greykite.common.python_utils import get_pattern_cols
  from greykite.common.python_utils import unique_elements_in_list
label_desc: Use image node_id 10 for calling a global function with example usage: compute_min_changepoint_index_distance(df, time_col, n_changepoints, min_distance_between_changepoints) and returns: int, df