code: def _differences_unit_level(
      variable_info: VariableInfo, effect_type: str
  ) -> pd.DataFrame:
      """Creates the data for unit-level contrasts by using the observed (empirical)
      data. All covariates in the model are included in the data, except for the
      contrast predictor. The contrast predictor is replaced with either: (1) the
      default contrast value, or (2) the user specified contrast value.
  
      Parameters
      ----------
      variable_info : VariableInfo
          Information about the variable of interest. This is `contrast` for
          'comparisons' and `wrt` for 'slopes'.
      effect_type : str
          The type of effect being computed. Either "comparisons" or "slopes".
  
      Returns
      -------
      pd.DataFrame
          A dataframe containing the unit-level data for the variable of interest
          value. This dataframe is the same length as the data used to fit the
          Bambi model.
      """
      covariates = get_model_covariates(variable_info.model)
      df = variable_info.model.data[covariates].drop(
          labels=variable_info.name, axis=1
      )
      variable_vals = variable_info.values
  
      if effect_type == "comparisons":
          variable_vals = np.array(variable_info.values)[..., None]
          variable_vals = np.repeat(
              variable_vals, variable_info.model.data.shape[0], axis=1
          )
  
      unit_level_df_dict = {}
      for idx, value in enumerate(variable_vals):
          unit_level_df_dict[f"contrast_{idx}"] = df.copy()
          unit_level_df_dict[f"contrast_{idx}"][
              variable_info.name
          ] = value
  
      unit_level_df = pd.concat(unit_level_df_dict.values())
  
      return unit_level_df.reset_index(drop=True)
  
file_path: bambi/bambi/interpret/create_data.py
imports: import itertools
  from typing import Union
  from statistics import mode
  import numpy
  import pandas
  from pandas.api.types import is_categorical_dtype, is_float_dtype, is_integer_dtype, is_numeric_dtype, is_object_dtype, is_string_dtype
  from bambi import Model
  from bambi.interpret.utils import ConditionalInfo, enforce_dtypes, get_model_covariates, VariableInfo
  from bambi.interpret.logs import log_interpret_defaults
label_desc: Use image node_id 3 for calling a global function with example usage: _differences_unit_level(variable_info, effect_type) and returns: unit_level_df