Search code examples
pythonbokeh

DataTable in Bokeh - How do you hide the index column?


How do you hide the index header column in a bokeh DataTable?


Solution

  • It took me a long time to figure this one out, so I wanted to post it:

    According to the documentation:

    index_position

    property type: Int

    Where among the list of columns to insert a column displaying the row index. Negative indices are supported, and specify an index position from the end of the list of columns (i.e. standard Python behaviour).

    To prevent the index column from being added, set to None.

    If the absolute value of index_position is larger than the length of the columns, then the index will appear at the beginning or end, depending on the sign.

    So, set index_position=None like so:

    table = DataTable(..., index_position=None, ...)