class_docstr: Helps style a DataFrame or Series according to the data with HTML and CSS.
  
  Parameters
  ----------
  data : Series or DataFrame
  precision : int
      precision to round floats to, defaults to pd.options.display.precision
  table_styles : list-like, default None
      list of {selector: (attr, value)} dicts; see Notes
  uuid : str, default None
      a unique identifier to avoid CSS collisions; generated automatically
  caption : str, default None
      caption to attach to the table
  cell_ids : bool, default True
      If True, each cell will have an ``id`` attribute in their HTML tag.
      The ``id`` takes the form ``T_<uuid>_row<num_row>_col<num_col>``
      where ``<uuid>`` is the unique identifier, ``<num_row>`` is the row
      number and ``<num_col>`` is the column number.
  
  Attributes
  ----------
  env : Jinja2 Environment
  template : Jinja2 Template
  loader : Jinja2 Loader
  
  See Also
  --------
  pandas.DataFrame.style
  
  Notes
  -----
  Most styling will be done by passing style functions into
  ``Styler.apply`` or ``Styler.applymap``. Style functions should
  return values with strings containing CSS ``'attr: value'`` that will
  be applied to the indicated cells.
  
  If using in the Jupyter notebook, Styler has defined a ``_repr_html_``
  to automatically render itself. Otherwise call Styler.render to get
  the generated HTML.
  
  CSS classes are attached to the generated HTML
  
  * Index and Column names include ``index_name`` and ``level<k>``
    where `k` is its level in a MultiIndex
  * Index label cells include
  
    * ``row_heading``
    * ``row<n>`` where `n` is the numeric position of the row
    * ``level<k>`` where `k` is the level in a MultiIndex
  
  * Column label cells include
    * ``col_heading``
    * ``col<n>`` where `n` is the numeric position of the column
    * ``evel<k>`` where `k` is the level in a MultiIndex
  
  * Blank cells include ``blank``
  * Data cells include ``data``
class_docstr_tok: ["Helps","style","a","DataFrame","or","Series","according","to","the","data","with","HTML","and","CSS",".","Parameters","--","--","--","--","--","data",":","Series","or","DataFrame","precision",":","int","precision","to","round","floats","to",",","defaults","to","pd.options.display.precision","table_styles",":","list-like",",","default","None","list","of","{","selector",":","(","attr",",","value",")","}","dicts",";","see","Notes","uuid",":","str",",","default","None","a","unique","identifier","to","avoid","CSS","collisions",";","generated","automatically","caption",":","str",",","default","None","caption","to","attach","to","the","table","cell_ids",":","bool",",","default","True","If","True",",","each","cell","will","have","an","``","id","``","attribute","in","their","HTML","tag",".","The","``","id","``","takes","the","form","``","T_","<","uuid",">","_row","<","num_row",">","_col","<","num_col",">","``","where","``","<","uuid",">","``","is","the","unique","identifier",",","``","<","num_row",">","``","is","the","row","number","and","``","<","num_col",">","``","is","the","column","number",".","Attributes","--","--","--","--","--","env",":","Jinja2","Environment","template",":","Jinja2","Template","loader",":","Jinja2","Loader","See","Also","--","--","--","--","pandas.DataFrame.style","Notes","--","--","-","Most","styling","will","be","done","by","passing","style","functions","into","``","Styler.apply","``","or","``","Styler.applymap","``",".","Style","functions","should","return","values","with","strings","containing","CSS","``","'attr",":","value","'","``","that","will","be","applied","to","the","indicated","cells",".","If","using","in","the","Jupyter","notebook",",","Styler","has","defined","a","``","_repr_html_","``","to","automatically","render","itself",".","Otherwise","call","Styler.render","to","get","the","generated","HTML",".","CSS","classes","are","attached","to","the","generated","HTML","*","Index","and","Column","names","include","``","index_name","``","and","``","level","<","k",">","``","where","`","k","`","is","its","level","in","a","MultiIndex","*","Index","label","cells","include","*","``","row_heading","``","*","``","row","<","n",">","``","where","`","n","`","is","the","numeric","position","of","the","row","*","``","level","<","k",">","``","where","`","k","`","is","the","level","in","a","MultiIndex","*","Column","label","cells","include","*","``","col_heading","``","*","``","col","<","n",">","``","where","`","n","`","is","the","numeric","position","of","the","column","*","``","evel","<","k",">","``","where","`","k","`","is","the","level","in","a","MultiIndex","*","Blank","cells","include","``","blank","``","*","Data","cells","include","``","data","``"]
docstr: Convert the DataFrame in `self.data` and the attrs from `_build_styles`
  into a dictionary of {head, body, uuid, cellstyle}.
code: def _translate(self):
      """
      Convert the DataFrame in `self.data` and the attrs from `_build_styles`
      into a dictionary of {head, body, uuid, cellstyle}.
      """
      table_styles = self.table_styles or []
      caption = self.caption
      ctx = self.ctx
      precision = self.precision
      hidden_index = self.hidden_index
      hidden_columns = self.hidden_columns
      uuid = self.uuid or str(uuid1()).replace("-", "_")
      ROW_HEADING_CLASS = "row_heading"
      COL_HEADING_CLASS = "col_heading"
      INDEX_NAME_CLASS = "index_name"
  
      DATA_CLASS = "data"
      BLANK_CLASS = "blank"
      BLANK_VALUE = ""
  
      def format_attr(pair):
          return "{key}={value}".format(**pair)
  
      # for sparsifying a MultiIndex
      idx_lengths = _get_level_lengths(self.index)
      col_lengths = _get_level_lengths(self.columns, hidden_columns)
  
      cell_context = dict()
  
      n_rlvls = self.data.index.nlevels
      n_clvls = self.data.columns.nlevels
      rlabels = self.data.index.tolist()
      clabels = self.data.columns.tolist()
  
      if n_rlvls == 1:
          rlabels = [[x] for x in rlabels]
      if n_clvls == 1:
          clabels = [[x] for x in clabels]
      clabels = list(zip(*clabels))
  
      cellstyle = []
      head = []
  
      for r in range(n_clvls):
          # Blank for Index columns...
          row_es = [
              {
                  "type": "th",
                  "value": BLANK_VALUE,
                  "display_value": BLANK_VALUE,
                  "is_visible": not hidden_index,
                  "class": " ".join([BLANK_CLASS]),
              }
          ] * (n_rlvls - 1)
  
          # ... except maybe the last for columns.names
          name = self.data.columns.names[r]
          cs = [
              BLANK_CLASS if name is None else INDEX_NAME_CLASS,
              "level{lvl}".format(lvl=r),
          ]
          name = BLANK_VALUE if name is None else name
          row_es.append(
              {
                  "type": "th",
                  "value": name,
                  "display_value": name,
                  "class": " ".join(cs),
                  "is_visible": not hidden_index,
              }
          )
  
          if clabels:
              for c, value in enumerate(clabels[r]):
                  cs = [
                      COL_HEADING_CLASS,
                      "level{lvl}".format(lvl=r),
                      "col{col}".format(col=c),
                  ]
                  cs.extend(
                      cell_context.get("col_headings", {})
                      .get(r, {})
                      .get(c, [])
                  )
                  es = {
                      "type": "th",
                      "value": value,
                      "display_value": value,
                      "class": " ".join(cs),
                      "is_visible": _is_visible(c, r, col_lengths),
                  }
                  colspan = col_lengths.get((r, c), 0)
                  if colspan > 1:
                      es["attributes"] = [
                          format_attr(
                              {"key": "colspan", "value": colspan}
                          )
                      ]
                  row_es.append(es)
              head.append(row_es)
  
      if (
          self.data.index.names
          and com._any_not_none(*self.data.index.names)
          and not hidden_index
      ):
          index_header_row = []
  
          for c, name in enumerate(self.data.index.names):
              cs = [INDEX_NAME_CLASS, "level{lvl}".format(lvl=c)]
              name = "" if name is None else name
              index_header_row.append(
                  {"type": "th", "value": name, "class": " ".join(cs)}
              )
  
          index_header_row.extend(
              [
                  {
                      "type": "th",
                      "value": BLANK_VALUE,
                      "class": " ".join([BLANK_CLASS]),
                  }
              ]
              * (len(clabels[0]) - len(hidden_columns))
          )
  
          head.append(index_header_row)
  
      body = []
      for r, idx in enumerate(self.data.index):
          row_es = []
          for c, value in enumerate(rlabels[r]):
              rid = [
                  ROW_HEADING_CLASS,
                  "level{lvl}".format(lvl=c),
                  "row{row}".format(row=r),
              ]
              es = {
                  "type": "th",
                  "is_visible": (
                      _is_visible(r, c, idx_lengths)
                      and not hidden_index
                  ),
                  "value": value,
                  "display_value": value,
                  "id": "_".join(rid[1:]),
                  "class": " ".join(rid),
              }
              rowspan = idx_lengths.get((c, r), 0)
              if rowspan > 1:
                  es["attributes"] = [
                      format_attr({"key": "rowspan", "value": rowspan})
                  ]
              row_es.append(es)
  
          for c, col in enumerate(self.data.columns):
              cs = [
                  DATA_CLASS,
                  "row{row}".format(row=r),
                  "col{col}".format(col=c),
              ]
              cs.extend(
                  cell_context.get("data", {}).get(r, {}).get(c, [])
              )
              formatter = self._display_funcs[(r, c)]
              value = self.data.iloc[r, c]
              row_dict = {
                  "type": "td",
                  "value": value,
                  "class": " ".join(cs),
                  "display_value": formatter(value),
                  "is_visible": (c not in hidden_columns),
              }
              # only add an id if the cell has a style
              if self.cell_ids or not (
                  len(ctx[r, c]) == 1 and ctx[r, c][0] == ""
              ):
                  row_dict["id"] = "_".join(cs[1:])
              row_es.append(row_dict)
              props = []
              for x in ctx[r, c]:
                  # have to handle empty styles like ['']
                  if x.count(":"):
                      props.append(x.split(":"))
                  else:
                      props.append(["", ""])
              cellstyle.append(
                  {
                      "props": props,
                      "selector": "row{row}_col{col}".format(
                          row=r, col=c
                      ),
                  }
              )
          body.append(row_es)
  
      table_attr = self.table_attributes
      use_mathjax = get_option("display.html.use_mathjax")
      if not use_mathjax:
          table_attr = table_attr or ""
          if 'class="' in table_attr:
              table_attr = table_attr.replace(
                  'class="', 'class="tex2jax_ignore '
              )
          else:
              table_attr += ' class="tex2jax_ignore"'
  
      return dict(
          head=head,
          cellstyle=cellstyle,
          body=body,
          uuid=uuid,
          precision=precision,
          table_styles=table_styles,
          caption=caption,
          table_attributes=table_attr,
      )
  
imports: from collections import defaultdict
  from contextlib import contextmanager
  import copy
  from functools import partial
  from itertools import product
  from uuid import uuid1
  import numpy
  from pandas.compat import range
  from pandas.util._decorators import Appender
  from pandas.core.dtypes.common import is_float, is_string_like
  from pandas.core.dtypes.generic import ABCSeries
  import pandas
  from pandas.api.types import is_dict_like, is_list_like
  import pandas.core.common
  from pandas.core.config import get_option
  from pandas.core.generic import _shared_docs
  from pandas.core.indexing import _maybe_numeric_slice, _non_reducing_slice
label_desc: Use image node_id 4 for calling the Styler obj's underlying member method code with example usage: obj._translate() and returns: dict, str