code: def check_new_observation(new_observation, explainer):
      new_observation_ = deepcopy(new_observation)
      if isinstance(new_observation_, pd.Series):
          new_observation_ = new_observation_.to_frame().T
          new_observation_.columns = explainer.data.columns
      elif isinstance(new_observation_, np.ndarray):
          if new_observation_.ndim == 1:
              # make 1D array 2D
              new_observation_ = new_observation_.reshape((1, -1))
          elif new_observation_.ndim > 2:
              raise ValueError("Wrong new_observation dimension")
          elif new_observation.shape[0] != 1:
              raise ValueError("Wrong new_observation dimension")
  
          new_observation_ = pd.DataFrame(new_observation_)
          new_observation_.columns = explainer.data.columns
  
      elif isinstance(new_observation_, list):
          new_observation_ = pd.DataFrame(new_observation_).T
          new_observation_.columns = explainer.data.columns
  
      elif isinstance(new_observation_, pd.DataFrame):
          if new_observation.shape[0] != 1:
              raise ValueError("Wrong new_observation dimension")
  
          new_observation_.columns = explainer.data.columns
      else:
          raise TypeError(
              "new_observation must be a numpy.ndarray or pandas.Series or pandas.DataFrame"
          )
  
      if pd.api.types.is_bool_dtype(new_observation_.index):
          raise ValueError("new_observation index is of boolean type")
  
      return new_observation_
  
file_path: DALEX/python/dalex/dalex/aspect/_predict_aspect_importance/checks.py
imports: import numpy
  import pandas
  from copy import deepcopy
  from warnings import warn
label_desc: Use image node_id 2 for calling a global function with example usage: check_new_observation(new_observation, explainer) and returns: new_observation_