class_docstr: Bridge pattern decoupling the application part from SmartExplainer and SmartPlotter.
  Attributes
  ----------
  explainer: object
      SmartExplainer instance to point to.
class_docstr_tok: ["Bridge","pattern","decoupling","the","application","part","from","SmartExplainer","and","SmartPlotter",".","Attributes","--","--","--","--","--","explainer",":","object","SmartExplainer","instance","to","point","to","."]
docstr: Method which initializes data from explainer object
docstr_tok: ["Method","which","initializes","data","from","explainer","object"]
code: def init_data(self, rows=None):
      """
      Method which initializes data from explainer object
      """
      if hasattr(self.explainer, "y_pred"):
          self.dataframe = self.explainer.x_init.copy()
          if isinstance(
              self.explainer.y_pred, (pd.Series, pd.DataFrame)
          ):
              self.predict_col = (
                  self.explainer.y_pred.columns.to_list()[0]
              )
              self.dataframe = self.dataframe.join(
                  self.explainer.y_pred
              )
          elif isinstance(self.explainer.y_pred, list):
              self.dataframe = self.dataframe.join(
                  pd.DataFrame(
                      data=self.explainer.y_pred,
                      columns=[self.predict_col],
                      index=self.explainer.x_init.index,
                  )
              )
          else:
              raise TypeError(
                  "y_pred must be of type pd.Series, pd.DataFrame or list"
              )
      else:
          raise ValueError(
              "y_pred must be set when calling compile function."
          )
  
      if self.explainer.additional_data is not None:
          self.dataframe = self.dataframe.join(
              self.explainer.additional_data
          )
          self.features_dict.update(
              self.explainer.additional_features_dict
          )
  
      self.dataframe["_index_"] = self.explainer.x_init.index
      self.dataframe.rename(
          columns={f"{self.predict_col}": "_predict_"}, inplace=True
      )
      if self.explainer.y_target is not None:
          self.dataframe = self.dataframe.join(
              self.explainer.y_target.rename(
                  columns={
                      self.explainer.y_target.columns[0]: "_target_"
                  }
              ),
          )
          if self.explainer._case == "regression":
              self.dataframe = self.dataframe.join(
                  self.explainer.prediction_error
              )
  
      col_order = (
          self.special_cols
          + self.dataframe.columns.drop(self.special_cols).tolist()
      )
      random.seed(79)
      if rows is None:
          rows = self.settings["rows"]
      self.list_index = random.sample(
          population=self.dataframe.index.tolist(),
          k=min(rows, len(self.dataframe.index.tolist())),
      )
      self.dataframe = (
          self.dataframe[col_order].loc[self.list_index].sort_index()
      )
      self.round_dataframe = self.dataframe.copy()
      for col in list(self.dataframe.columns):
          typ = self.dataframe[col].dtype
          if typ == float:
              std = self.dataframe[col].std()
              if std != 0:
                  digit = max(round(log10(1 / std) + 1) + 2, 0)
                  self.round_dataframe[col] = (
                      self.dataframe[col]
                      .map(f"{{:.{digit}f}}".format)
                      .astype(float)
                  )
  
imports: import copy
  import dash
  from dash import dash_table
  import dash_daq
  from dash import no_update
  from dash.exceptions import PreventUpdate
  import dash_bootstrap_components
  from dash import dcc
  from dash import html
  from dash import MATCH, ALL
  from dash.dependencies import Output, Input, State
  from flask import Flask
  import pandas
  import plotly.graph_objs
  import random
  import re
  from math import log10
  from shapash.webapp.utils.utils import check_row, get_index_type, round_to_k
  from shapash.webapp.utils.MyGraph import MyGraph
  from shapash.utils.utils import truncate_str
  from shapash.webapp.utils.explanations import Explanations
  from shapash.webapp.utils.callbacks import select_data_from_prediction_picking, select_data_from_str_filters, select_data_from_bool_filters, select_data_from_numeric_filters, select_data_from_date_filters, get_feature_from_clicked_data, get_feature_from_features_groups, get_group_name, get_indexes_from_datatable, update_click_data_on_subset_changes, get_figure_zoom, get_feature_contributions_sign_to_show, update_features_to_display, get_id_card_features, get_id_card_contrib, create_id_card_data, create_id_card_layout, get_feature_filter_options, create_dropdown_feature_filter, create_filter_modalities_selection
label_desc: Use image node_id 2 for calling the SmartApp obj's underlying member method code with example usage: obj.init_data(rows) without return types