Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeserializationError when editing Data Table #7417

pdmich opened this issue Jan 16, 2018 · 7 comments · Fixed by #8310

DeserializationError when editing Data Table #7417

pdmich opened this issue Jan 16, 2018 · 7 comments · Fixed by #8310


Copy link

pdmich commented Jan 16, 2018

Current environment:

  • Bokeh 0.12.14dev3 (although I think the same error occurs in 0.12.13)
  • Python 3.6
  • Windows 10
  • Google Chrome

When editing or clicking on cells in a data table bokeh will display a DeserializationError:

This can be tested with the example on the bokeh github. Open that server up and then click on a cell and the error should appear. Not sure where this is coming from, but I do believe it happened somewhere after 0.12.10 (which doesn't produce the error).

Copy link

mattpap commented Jan 16, 2018

Looks like a typed array.

Copy link

bryevdv commented Jan 30, 2018

Binary array transport landed in 0.12.9 so it's not directly that.

Copy link

bryevdv commented Jan 30, 2018

Also, that example is gone (all the bad examples of bokeh.client "app outside the server" were removed) but here is an updated export_csv that shows the issue:

import pandas as pd

from bokeh.layouts import row, widgetbox
from bokeh.models.widgets import Select, MultiSelect
from bokeh.plotting import curdoc, figure
from bokeh.models import ColumnDataSource, LabelSet
from bokeh.models.ranges import FactorRange
from import show

df = pd.DataFrame(data={
        'category': ['e', 'e', 'f', 'f'],
        'subcategory': ['a', 'b', 'c', 'd'],
        'number': [1, 2, 3, 4],
        'number2': [5, 6, 7, 8]

df['cat_sub'] = list(zip(df.category, df.subcategory))

source = ColumnDataSource(df)

p = figure(plot_width=800,
           title='sweet', plot_height=500)

h1 = p.hbar(right="number", y="cat_sub", color='darkgrey',
            height=0.8, source=source)

labels = LabelSet(
        text='number', text_font_size='9pt', level='glyph',
        x='number', y='cat_sub', x_offset=3, y_offset=-6.5,


def update_source():
    df2 = df.copy()
    df3 = df2[
            & df2.subcategory.isin(subcats.value)]
    df4 = df3.reindex(columns=['category', 'subcategory', nums.value])
    df4['cat_sub'] = list(zip(df4.category, df4.subcategory)) = source.from_df(df4)

def update_glyph():
    h1.glyph.right = nums.value
    labels.text = nums.value
    labels.x = nums.value

def update(attr, old, new):
    r.children[1] = update_glyph()

catlist_u = df['category'].unique().tolist()
subcatlist_u = df['subcategory'].unique().tolist()

cats = MultiSelect(title='Category', value=['f'], options=catlist_u)

subcats = MultiSelect(title='Subcategory', value=['a'],

nums = Select(title='Value', value='number2', options=['number', 'number2'])

cats.on_change('value', update)
subcats.on_change('value', update)
nums.on_change('value', update)

w = widgetbox([cats, subcats, nums])

r = row([w, p], sizing_mode="scale_width")

curdoc().title = "test"

Copy link

mattpap commented Jan 30, 2018

I was able to reproduce this with some app examples. I will try to fix it tomorrow.

Copy link

bryevdv commented Jan 30, 2018

FYI a potential workaround for now at least is to use python lists for a datatable source:

def update():
    current = df[(df['salary'] >= slider.value[0]) & (df['salary'] <= slider.value[1])].dropna() = {
        'name'             : list(,
        'salary'           : list(current.salary),
        'years_experience' : list(current.years_experience),

@bryevdv bryevdv modified the milestones: 0.12.14, 0.12.x Feb 1, 2018
Copy link

smilerz commented Mar 7, 2018

Note to anyone that uses the workaround @bryevdv suggested:
You have to either drop or fill or otherwise change any NaN or NaT values in your DataFrame before assigning them to the list.

Otherwise the workaround seemed to correct the issue I was having.

Copy link

Just to let you know this is still there in `0.13.0dev11'. A minimal(er) example:

import numpy as np

from bokeh.models import ColumnDataSource
from import curdoc, output_notebook, push_notebook, show
from bokeh.models.widgets import DataTable, TableColumn, StringFormatter

data = dict(
X = np.linspace(0, 10), # Wrap with list() to remove the unhandled error
Y = np.linspace(10, 20) # Wrap with list() to remove the unhandled error
source = ColumnDataSource(data)

columns = [ 
TableColumn(field="X", title="X",formatter=StringFormatter(font_style="bold",text_color="midnightblue")),TableColumn(field="Y", title="Y",formatter=StringFormatter(font_style="bold",text_color="midnightblue")),

data_table = DataTable(source=source,
                       width=850, height=280,       


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging a pull request may close this issue.

5 participants