class_docstr: PerspectiveViewer wraps the `perspective.Table` API and exposes an API
  around creating views, loading data, and updating data.
class_docstr_tok: ["PerspectiveViewer","wraps","the","`","perspective.Table","`","API","and","exposes","an","API","around","creating","views",",","loading","data",",","and","updating","data","."]
docstr: Given a ``perspective.Table``, a ``perspective.View``,
  or data that can be handled by ``perspective.Table``, pass it to the
  viewer.  Like `__init__`, load accepts a `perspective.Table`, a dataset,
  or a schema. If running in client mode, `load` defers to the browser's
  Perspective engine. This means that loading Python-only datasets,
  especially ones that cannot be serialized into JSON, may cause some
  issues.
  
  ``load()`` resets the state of the viewer :
  
  * If a ``perspective.Table`` has already been  loaded, ``**options`` is
    ignored as the options already set on the ``Table`` take precedence.
  
  * If a ``perspective.View`` is loaded, the options on the
    ``perspective.Table`` linked to the view take precedence.
  
  If data is passed in, a ``perspective.Table`` is automatically created
  by this method, and the options passed to ``**config`` are extended to
  the new Table.  If the widget already has a dataset, and the new data
  has different columns to the old one, then the widget state (pivots,
  sort, etc.) is cleared to prevent applying settings on columns that
  don't exist.
  
  Args:
      data (:obj:`Table`|:obj:`View`|:obj:`dict`|:obj:`list`|:obj:`pandas.DataFrame`|:obj:`bytes`|:obj:`str`): a
          `perspective.Table` instance, a `perspective.View` instance, or
          a dataset to be loaded in the viewer.
  
  Keyword Arguments:
      name (:obj:`str`): An optional name to reference the table by so it can
          be accessed from the front-end. If not provided, a name will
          be generated.
      index (:obj:`str`): A column name to be used as the primary key.
          Ignored if a ``Table`` or ``View`` is supplied.
      limit (:obj:`int`): A upper limit on the number of rows in the Table.
          Cannot be set at the same time as `index`. Ignored if a
          ``Table`` or ``View`` is supplied.
  
  Examples:
      >>> from perspective import Table, PerspectiveViewer
      >>> data = {"a": [1, 2, 3]}
      >>> tbl = Table(data)
      >>> viewer = PerspectiveViewer()
      >>> viewer.load(tbl)
      >>> viewer.load(data, index="a") # viewer state is reset
      >>> viewer2 = PerspectiveViewer()
      >>> viewer2.load(tbl.view())
docstr_tok: ["Given","a","``","perspective.Table","``",",","a","``","perspective.View","``",",","or","data","that","can","be","handled","by","``","perspective.Table","``",",","pass","it","to","the","viewer",".","Like","`","__init__","`",",","load","accepts","a","`","perspective.Table","`",",","a","dataset",",","or","a","schema",".","If","running","in","client","mode",",","`","load","`","defers","to","the","browser's","Perspective","engine",".","This","means","that","loading","Python-only","datasets",",","especially","ones","that","can","not","be","serialized","into","JSON",",","may","cause","some","issues",".","``","load","(",")","``","resets","the","state","of","the","viewer",":","*","If","a","``","perspective.Table","``","has","already","been","loaded",",","``","*","*","options","``","is","ignored","as","the","options","already","set","on","the","``","Table","``","take","precedence",".","*","If","a","``","perspective.View","``","is","loaded",",","the","options","on","the","``","perspective.Table","``","linked","to","the","view","take","precedence",".","If","data","is","passed","in",",","a","``","perspective.Table","``","is","automatically","created","by","this","method",",","and","the","options","passed","to","``","*","*","config","``","are","extended","to","the","new","Table",".","If","the","widget","already","has","a","dataset",",","and","the","new","data","has","different","columns","to","the","old","one",",","then","the","widget","state","(","pivots",",","sort",",","etc",".",")","is","cleared","to","prevent","applying","settings","on","columns","that","do","n't","exist",".","Args",":","data","(",":","obj",":","`","Table","`","|",":","obj",":","`","View","`","|",":","obj",":","`","dict","`","|",":","obj",":","`","list","`","|",":","obj",":","`","pandas.DataFrame","`","|",":","obj",":","`","bytes","`","|",":","obj",":","`","str","`",")",":","a","`","perspective.Table","`","instance",",","a","`","perspective.View","`","instance",",","or","a","dataset","to","be","loaded","in","the","viewer",".","Keyword","Arguments",":","name","(",":","obj",":","`","str","`",")",":","An","optional","name","to","reference","the","table","by","so","it","can","be","accessed","from","the","front-end",".","If","not","provided",",","a","name","will","be","generated",".","index","(",":","obj",":","`","str","`",")",":","A","column","name","to","be","used","as","the","primary","key",".","Ignored","if","a","``","Table","``","or","``","View","``","is","supplied",".","limit","(",":","obj",":","`","int","`",")",":","A","upper","limit","on","the","number","of","rows","in","the","Table",".","Can","not","be","set","at","the","same","time","as","`","index","`",".","Ignored","if","a","``","Table","``","or","``","View","``","is","supplied",".","Examples",":",">",">",">","from","perspective","import","Table",",","PerspectiveViewer",">",">",">","data","=","{","``","a","''",":","[","1",",","2",",","3","]","}",">",">",">","tbl","=","Table","(","data",")",">",">",">","viewer","=","PerspectiveViewer","(",")",">",">",">","viewer.load","(","tbl",")",">",">",">","viewer.load","(","data",",","index=","''","a","''",")","#","viewer","state","is","reset",">",">",">","viewer2","=","PerspectiveViewer","(",")",">",">",">","viewer2.load","(","tbl.view","(",")",")"]
code: def load(self, data, **options):
      """Given a ``perspective.Table``, a ``perspective.View``,
      or data that can be handled by ``perspective.Table``, pass it to the
      viewer.  Like `__init__`, load accepts a `perspective.Table`, a dataset,
      or a schema. If running in client mode, `load` defers to the browser's
      Perspective engine. This means that loading Python-only datasets,
      especially ones that cannot be serialized into JSON, may cause some
      issues.
  
      ``load()`` resets the state of the viewer :
  
      * If a ``perspective.Table`` has already been  loaded, ``**options`` is
        ignored as the options already set on the ``Table`` take precedence.
  
      * If a ``perspective.View`` is loaded, the options on the
        ``perspective.Table`` linked to the view take precedence.
  
      If data is passed in, a ``perspective.Table`` is automatically created
      by this method, and the options passed to ``**config`` are extended to
      the new Table.  If the widget already has a dataset, and the new data
      has different columns to the old one, then the widget state (pivots,
      sort, etc.) is cleared to prevent applying settings on columns that
      don't exist.
  
      Args:
          data (:obj:`Table`|:obj:`View`|:obj:`dict`|:obj:`list`|:obj:`pandas.DataFrame`|:obj:`bytes`|:obj:`str`): a
              `perspective.Table` instance, a `perspective.View` instance, or
              a dataset to be loaded in the viewer.
  
      Keyword Arguments:
          name (:obj:`str`): An optional name to reference the table by so it can
              be accessed from the front-end. If not provided, a name will
              be generated.
          index (:obj:`str`): A column name to be used as the primary key.
              Ignored if a ``Table`` or ``View`` is supplied.
          limit (:obj:`int`): A upper limit on the number of rows in the Table.
              Cannot be set at the same time as `index`. Ignored if a
              ``Table`` or ``View`` is supplied.
  
      Examples:
          >>> from perspective import Table, PerspectiveViewer
          >>> data = {"a": [1, 2, 3]}
          >>> tbl = Table(data)
          >>> viewer = PerspectiveViewer()
          >>> viewer.load(tbl)
          >>> viewer.load(data, index="a") # viewer state is reset
          >>> viewer2 = PerspectiveViewer()
          >>> viewer2.load(tbl.view())
  
      """
      name = options.pop("name", str(random()))
  
      if isinstance(data, Table):
          table = data
      elif isinstance(data, View):
          raise PerspectiveError("Only `Table` or data can be loaded.")
      else:
          table = Table(data, **options)
  
      self.manager.host_table(name, table)
  
      # Reset the viewer when `load()` is called multiple times.
      if self.table_name is not None:
          self.reset()
  
      # If the user does not set columns to show, synchronize viewer state
      # with dataset.
      if len(self.columns) == 0:
          self.columns = table.columns()
  
      self.table_name = name
  
file_path: perspective/python/perspective/perspective/viewer/viewer.py
imports: from random import random
  from ..libpsp import is_libpsp
  from .validate import validate_aggregates, validate_split_by, validate_columns, validate_expressions, validate_filter, validate_plugin, validate_plugin_config, validate_group_by, validate_sort
  from .viewer_traitlets import PerspectiveTraitlets
label_desc: Use image node_id 3 for calling the PerspectiveViewer obj's underlying member method code with example usage: obj.load(data) without return types