class_docstr: Serializes pandas.DataFrame instance into HTML format.
  
  Parameters
  ----------
  value : Union[pandas.DataFrame, Styler]
      DataFrame instance that needed to be serialized.
docstr: Serialize pandas.DataFrame instance into HTML format.
docstr_tok: ["Serialize","pandas.DataFrame","instance","into","HTML","format","."]
code: def serialize(self, **kwargs) -> str:
      """Serialize pandas.DataFrame instance into HTML format."""
      try:
          if isinstance(self.value, pd.DataFrame):
              df_styler = self.value.style
          else:
              df_styler = self.value
  
          pd_version = parse_version(pd.__version__)
          # Set precision is deprecated since pandas 1.3.0
          if pd_version < parse_version("1.3.0"):
              df_styler.set_precision(2)
          else:
              df_styler.format(precision=2)
          table_css_props = [
              ("text-align", "left"),  # Align everything to the left
              (
                  "white-space",
                  "pre-wrap",
              ),  # Define how to handle white space characters (like \n)
          ]
          df_styler.set_table_styles(
              [
                  dict(
                      selector="table,thead,tbody,th,td",
                      props=table_css_props,
                  )
              ]
          )
          # render is deprecated since pandas 1.4.0
          if pd_version < parse_version("1.4.0"):
              return df_styler.render()
          else:
              return df_styler.to_html()
      # Because of MLC-154. Dataframe with Multi-index or non unique indices does not have a style
      # attribute, hence we need to display as a regular pd html format.
      except ValueError:
          return self.value.to_html()
  
file_path: deepchecks/deepchecks/core/serialization/dataframe/html.py
imports: import typing
  import pandas
  from pandas.io.formats.style import Styler
  from pkg_resources import parse_version
  from deepchecks.core.serialization.abc import HtmlSerializer
label_desc: Use image node_id 2 for calling the DataFrameSerializer obj's underlying member method code with example usage: obj.serialize() and returns: df_styler, df_styler, self