filters#

class AllIndices(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

Trivial filter that includes all indices in a dataset.

class BooleanFilter(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

A BooleanFilter filters data by returning the subset of data corresponding to indices where the values of the booleans array is True.

booleans#

A list of booleans indicating which rows of data to select.

class CustomJSFilter(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

Filter data sources with a custom defined JavaScript function.

Warning

The explicit purpose of this Bokeh Model is to embed raw JavaScript code for a browser to execute. If any part of the code is derived from untrusted user inputs, then you must take appropriate care to sanitize the user input prior to passing to Bokeh.

args#

A mapping of names to Python objects. In particular those can be bokeh’s models. These objects are made available to the callback’s code snippet as the values of named parameters to the callback.

code#

A snippet of JavaScript code to filter data contained in a columnar data source. The code is made into the body of a function, and all of of the named objects in args are available as parameters that the code can use. The variable source will contain the data source that is associated with the CDSView this filter is added to.

The code should either return the indices of the subset or an array of booleans to use to subset data source rows.

Example:

code = '''
const indices = []
for (let i = 0; i <= source.data['some_column'].length; i++) {
    if (source.data['some_column'][i] == 'some_value') {
        indices.push(i)
    }
}
return indices
'''
class DifferenceFilter(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

Computes difference of indices resulting from other filters.

class Filter(*args: Any, id: ID | None = None, **kwargs: Any)[source]#
A Filter model represents a filtering operation that returns a row-wise subset of

data when applied to a ColumnDataSource.

Note

This is an abstract base class used to help organize the hierarchy of Bokeh model types. It is not useful to instantiate on its own.

class GroupFilter(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

A GroupFilter represents the rows of a ColumnDataSource where the values of the column indicated by column_name match the group variable.

column_name#

The name of the column to perform the group filtering operation on.

group#

The value of the column indicating the rows of data to keep.

class IndexFilter(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

An IndexFilter filters data by returning the subset of data at a given set of indices.

indices#

A list of integer indices representing the subset of data to select.

class IntersectionFilter(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

Computes intersection of indices resulting from other filters.

class InversionFilter(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

Inverts indices resulting from another filter.

operand#

Indices produced by this filter will be inverted.

class SymmetricDifferenceFilter(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

Computes symmetric difference of indices resulting from other filters.

class UnionFilter(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

Computes union of indices resulting from other filters.