# Buggy code
def _update(self, model):
    if self.object is None:
        json = None
    else:
        json = self._to_json(self.object)
        self._get_sources(json, model.data_sources)
    model.data = json


# Traceback (KeyError)
KeyError                                  Traceback (most recent call last)
/opt/conda/lib/python3.6/site-packages/IPython/core/formatters.py in __call__(self, obj, include, exclude)
968
969             if method is not None:
--> 970                 return method(include=include, exclude=exclude)
971             return None
972         else:

/opt/conda/lib/python3.6/site-packages/panel/viewable.py in _repr_mimebundle_(self, include, exclude)
292         comm = state._comm_manager.get_server_comm()
293         doc = _Document()
--> 294         model = self._render_model(doc, comm)
295         if config.embed:
296             return render_model(model)

/opt/conda/lib/python3.6/site-packages/panel/viewable.py in _render_model(self, doc, comm)
261         if comm is None:
262             comm = state._comm_manager.get_server_comm()
--> 263         model = self.get_root(doc, comm)
264
265         if config.embed:

/opt/conda/lib/python3.6/site-packages/panel/viewable.py in get_root(self, doc, comm)
416         """
417         doc = doc or _curdoc()
--> 418         root = self._get_model(doc, comm=comm)
419         self._preprocess(root)
420         ref = root.ref['id']

/opt/conda/lib/python3.6/site-packages/panel/layout.py in _get_model(self, doc, root, parent, comm)
113         if root is None:
114             root = model
--> 115         objects = self._get_objects(model, [], doc, root, comm)
116         props = dict(self._init_properties(), objects=objects)
117         model.update(**self._process_param_change(props))

/opt/conda/lib/python3.6/site-packages/panel/layout.py in _get_objects(self, model, old_objects, doc, root, comm)
105                 child, _ = pane._models[root.ref['id']]
106             else:
--> 107                 child = pane._get_model(doc, root, model, comm)
108             new_models.append(child)
109         return new_models

/opt/conda/lib/python3.6/site-packages/panel/param.py in _get_model(self, doc, root, parent, comm)
614         if ref in self._models:
615             self._cleanup(root)
--> 616         model = self._inner_layout._get_model(doc, root, parent, comm)
617         self._models[ref] = (model, parent)
618         return model

/opt/conda/lib/python3.6/site-packages/panel/layout.py in _get_model(self, doc, root, parent, comm)
113         if root is None:
114             root = model
--> 115         objects = self._get_objects(model, [], doc, root, comm)
116         props = dict(self._init_properties(), objects=objects)
117         model.update(**self._process_param_change(props))

/opt/conda/lib/python3.6/site-packages/panel/layout.py in _get_objects(self, model, old_objects, doc, root, comm)
105                 child, _ = pane._models[root.ref['id']]
106             else:
--> 107                 child = pane._get_model(doc, root, model, comm)
108             new_models.append(child)
109         return new_models

/opt/conda/lib/python3.6/site-packages/panel/pane/vega.py in _get_model(self, doc, root, parent, comm)
104         else:
105             json = self._to_json(self.object)
--> 106             self._get_sources(json, sources)
107         props = self._process_param_change(self._init_properties())
108         model = VegaPlot(data=json, data_sources=sources, **props)

/opt/conda/lib/python3.6/site-packages/panel/pane/vega.py in _get_sources(self, json, sources)
76                 import altair as alt
77                 if (not isinstance(self.object.data, alt.Data) and
---> 78                     columns == set(self.object.data)):
79                     data = ColumnDataSource.from_df(self.object.data)
80                 else:

/opt/conda/lib/python3.6/site-packages/altair/utils/schemapi.py in __getitem__(self, item)
233
234     def __getitem__(self, item):
--> 235         return self._kwds[item]
236
237     def __setitem__(self, item, val):

KeyError: 0

Row
[0] Column
[0] Select(name='Area type:', options=['Country', 'Sub-Region', ...], value='Country')
[1] ParamFunction(function)

# Fixed code
def _update(self, model):
    if self.object is None:
        json = None
    else:
        json = self._to_json(self.object)
        self._get_sources(json, model.data_sources)
    props = {
        p: getattr(self, p)
        for p in list(Layoutable.param)
        if getattr(self, p) is not None
    }
    self._get_dimensions(json, props)
    props["data"] = json
    model.update(**props)