☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Pandas Categorical Index with Bokeh high-level charting API

Community Support
siddhartha.a.gandhi
siddhartha.a.gandhi

It seems as though Bokeh’s high-level charting API, for instance bokeh.charts.Bar, does not respect the order inherent in a Pandas Categorical Index. One data series I was looking at contained Moody’s ratings (see Bond credit rating - Wikipedia for the scale). Alphabetical order would place the “A1” value first. When I use bokeh.charts.Bar, in fact, A1 is the first value on the left of the chart.

To solve this, I attempted to use an ordered Pandas categorical index for the series I pass in, which explicitly places “Aaa” first, and “Aa1” second, etc., but this does not seem to change anything in the resulting bar plot.

I will post example code and plots shortly, just wanted to start this discussion, to see what others’ experience has been.

⌁   Link to post
birdsarah_continuum
birdsarah_continuum

There’s an option to
not sort. I’ve forgotten how to use it - I’m pretty sure it’s in an example somewhere.

···

On 8/27/16 11:26 AM,
wrote:

siddhartha.a.gandhi@gmail.com

    It seems as though Bokeh's high-level charting API,

for instance bokeh.charts.Bar, does not respect the order
inherent in a Pandas Categorical Index. One data series I was
looking at contained Moody’s ratings
(see
for the scale). Alphabetical order would place the “A1” value
first. When I use bokeh.charts.Bar, in fact, A1 is the first
value on the left of the chart.

–

  You received this message because you are subscribed to the Google

Groups “Bokeh Discussion - Public” group.

  To unsubscribe from this group and stop receiving emails from it,

send an email to bokeh+unsubscribe@continuum.io.

  To post to this group, send email to bokeh@continuum.io.

  To view this discussion on the web visit [https://groups.google.com/a/continuum.io/d/msgid/bokeh/c96983c1-5732-462a-9f3d-88f532ef033e%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/c96983c1-5732-462a-9f3d-88f532ef033e%40continuum.io?utm_medium=email&utm_source=footer).

  For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).

–
Sarah Bird
Developer, Bokeh

    [
      ![Continuum Analytics](http://docs.continuum.io/_static/img/ContinuumWordmark.png)
    ](http://continuum.io)

https://en.wikipedia.org/wiki/Bond_credit_rating#Credit_rating_tiers

      To solve this, I attempted to use an ordered Pandas

categorical index for the series I pass in, which explicitly
places “Aaa” first, and “Aa1” second, etc., but this does not
seem to change anything in the resulting bar plot.

        I will post example code and plots shortly, just wanted

to start this discussion, to see what others’ experience has
been.

⌁   Link to post

End of archived discussion · Replies are disabled