class_docstr: :class`~perspective.PerspectiveWidget` allows for Perspective to be used
  in the form of a Jupyter IPython widget.
  
  Using `perspective.Table`, you can create a widget that extends the full
  functionality of `perspective-viewer`.  Changes on the viewer can be
  programatically set on the :class`~perspective.PerspectiveWidget` instance,
  and state is maintained across page refreshes.
  
  Examples:
      >>> from perspective import Table, PerspectiveWidget
      >>> data = {
      ...     "a": [1, 2, 3],
      ...     "b": [
      ...         "2019/07/11 7:30PM",
      ...         "2019/07/11 8:30PM",
      ...         "2019/07/11 9:30PM"
      ...     ]
      ... }
      >>> tbl = Table(data, index="a")
      >>> widget = PerspectiveWidget(
      ...     tbl,
      ...     group_by=["a"],
      ...     sort=[["b", "desc"]],
      ...     filter=[["a", ">", 1]]
      ... )
      >>> widget.sort
      [["b", "desc"]]
      >>> widget.sort.append(["a", "asc"])
      >>> widget.sort
      [["b", "desc"], ["a", "asc"]]
      >>> widget.update({"a": [4, 5]}) # Browser UI updates
docstr: Update the widget with new data. If running in client mode, this
  method serializes the data and calls the browser viewer's update
  method. Otherwise, it calls `Viewer.update()` using `super()`.
docstr_tok: ["Update","the","widget","with","new","data",".","If","running","in","client","mode",",","this","method","serializes","the","data","and","calls","the","browser","viewer","'s","update","method",".","Otherwise",",","it","calls","`","Viewer.update","(",")","`","using","`","super","(",")","`","."]
code: def update(self, data):
      """Update the widget with new data. If running in client mode, this
      method serializes the data and calls the browser viewer's update
      method. Otherwise, it calls `Viewer.update()` using `super()`.
      """
      if self.client is True:
          # serialize the data and send a custom message to the browser
          if isinstance(data, pandas.DataFrame) or isinstance(
              data, pandas.Series
          ):
              data, _ = deconstruct_pandas(data)
          d = _serialize(data)
          self.post({"cmd": "update", "data": d})
      else:
          super(PerspectiveWidget, self).update(data)
  
imports: import base64
  import jinja2
  import json
  import os
  from datetime import date, datetime
  from functools import partial
  import numpy
  import pandas
  from ipywidgets import DOMWidget
  from traitlets import Unicode, observe
  from ..core._version import __version__
  from ..core.data import deconstruct_pandas
  from ..core.exception import PerspectiveError
  from ..libpsp import is_libpsp
  from ..viewer import PerspectiveViewer
label_desc: Use image node_id 3 for calling the PerspectiveWidget obj's underlying member method code with example usage: obj.update(data) without return types