import numpy as np
from bokeh import io as bkio
import bokeh.models as bkm
bkio.output_file('test_table_sort.html')
source = bkm.ColumnDataSource({
'journal': ['The Lancet', 'Clinical and experimental pediatrics',
'Anales de Pediatria', 'Annals of translational medicine', 'CMAJ'],
'citescore': [10.28, np.nan, 0.43, np.nan, 1.12],
})
d = bkm.DataTable(columns=[bkm.widgets.TableColumn(field='journal', title='journal'),
bkm.widgets.TableColumn(field='citescore', title='citescore',
formatter=bkm.NumberFormatter(format='0.0'))], source=source)
bkio.show(d)
[bokeh] setting log level to: 'info'
bokeh-tables-2.1.1.min.js:47 [bokeh] jquery-ui is required to enable DataTable.reorderable
render @ bokeh-tables-2.1.1.min.js:47
bokeh-2.1.1.min.js:162 [bokeh] document idle at 49 ms
Versions: Python 3.7.3; Bokeh 2.1.1; Numpy 1.18.5; Mac OS X 10.15.5; Chrome: Version 83.0.4103.116 (Official Build) (64-bit)
Issue: DataTable sorting not working as expected with NaNs. After sorting, NaNs are scattered through the column rather than being moved to top or bottom.
Example
Console output