☰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

Bokeh: ValueError: Out of range float values are not JSON compliant

Community Support
elvisyabadabadoo
elvisyabadabadoo

I put this on stackoverflow, but didn’t get much love so putting it here: http://stackoverflow.com/questions/38821132/bokeh-valueerror-out-of-range-float-values-are-not-json-compliant

down votefavorite

I came across this discussion (from a year ago): https://github.com/bokeh/bokeh/issues/2392

I also saw the white screen without any errors…and then i tried to take a small subset of 2 columns and tried the below:

Since pandas just gets a bunch of rows with empty data in there as well, I tried dropna… this resulted in there being no data at all. So instead I just specified the rows that should go into the df (hence the df = df.head(n=19) line)

import pandas as pd
from bokeh.plotting import figure, output_file, show
df = pd.read_excel(path,sheetname,parse_cols="A:B")
df = df.head(n=19)
print(df)
rtngs = ['iAAA','iAA+','iAA','iAA-','iA+','iA','iA-','iBBB+','iBBB','iBBB-','iBB+','iBB','iBB-','iB+','iB','iB-','NR','iCCC+']
x= df['Score']
output_file("line.html")

p = figure(plot_width=400, plot_height=400, x_range=(0,100),y_range=rtngs)

# add a circle renderer with a size, color, and alpha
p.circle(df['Score'], df['Rating'], size=20, color="navy", alpha=0.5)

# show the results
#output_notebook()
show(p)

df:

   Rating  Score
0    iAAA 64.0
1    iAA+   33.0
2     iAA 7.0
3    iAA-   28.0
4     iA+   36.0
5      iA 62.0
6     iA-   99.0
7   iBBB+   10.0
8    iBBB 93.0
9   iBBB-   91.0
10   iBB+   79.0
11    iBB 19.0
12   iBB-   95.0
13    iB+   26.0
14     iB 9.0
15    iB-   26.0
16     NR 49.0
17  iCCC+   51.0
18   iAAA 18.0

The above is showing me an output within the notebook, but still throws : ValueError: Out of range float values are not JSON compliant

And also it doesn’t (hence?) produce the output file as well. How do I get rid of this error for this small subset? Is it related to NaN values? Would that also solve the ‘white screen of death’ issue for the larger dataset?

Thanks vm for taking a look!

⌁   Link to post
Mateusz_Paprocki
Mateusz_Paprocki

Hi,

···

On Mon, Aug 8, 2016 at 9:20 AM, elvisyabadabadoo@gmail.com wrote:

I put this on stackoverflow, but didn’t get much love so putting it here: http://stackoverflow.com/questions/38821132/bokeh-valueerror-out-of-range-float-values-are-not-json-compliant

down votefavorite

I came across this discussion (from a year ago): https://github.com/bokeh/bokeh/issues/2392

I also saw the white screen without any errors…and then i tried to take a small subset of 2 columns and tried the below:

Since pandas just gets a bunch of rows with empty data in there as well, I tried dropna… this resulted in there being no data at all. So instead I just specified the rows that should go into the df (hence the df = df.head(n=19) line)

import pandas as pd
from bokeh.plotting import figure, output_file, show
df = pd.read_excel(path,sheetname,parse_cols="A:B")
df = df.head(n=19)
print(df)
rtngs = ['iAAA','iAA+','iAA','iAA-','iA+','iA','iA-','iBBB+','iBBB','iBBB-','iBB+','iBB','iBB-','iB+','iB','iB-','NR','iCCC+']
x= df['Score']
output_file("line.html")

p = figure(plot_width=400, plot_height=400, x_range=(0,100),y_range=rtngs)

# add a circle renderer with a size, color, and alpha
p.circle(df['Score'], df['Rating'], size=20, color="navy", alpha=0.5)

# show the results
#output_notebook()
show(p)

df:

   Rating  Score
0    iAAA 64.0
1    iAA+   33.0
2     iAA 7.0
3    iAA-   28.0
4     iA+   36.0
5      iA 62.0
6     iA-   99.0
7   iBBB+   10.0
8    iBBB 93.0
9   iBBB-   91.0
10   iBB+   79.0
11    iBB 19.0
12   iBB-   95.0
13    iB+   26.0
14     iB 9.0
15    iB-   26.0
16     NR 49.0
17  iCCC+   51.0
18   iAAA 18.0

this looks good and when converted to CSV, can be serialized by bokeh. It may be pd.read_excel() doing something unexpected. Can you tell us what dtypes are inferred by pandas? You could also covert the excel file to CSV and see if this loaded by pandas produces a data frame that’s understood by bokeh.

The above is showing me an output within the notebook, but still throws : ValueError: Out of range float values are not JSON compliant

And also it doesn’t (hence?) produce the output file as well. How do I get rid of this error for this small subset? Is it related to NaN values? Would that also solve the ‘white screen of death’ issue for the larger dataset?

Thanks vm for taking a look!

Mateusz

–

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/06c43986-e6a6-427f-8689-ce319f94a4c7%40continuum.io.

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

⌁   Link to post

End of archived discussion · Replies are disabled