Skip to content

[BUG] DataTable column sort not working with NaNs #10251

Description

@sggaffney

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

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)

Console output

[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

Screen Shot 2020-07-02 at 18 33 20

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions