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

Hello, i’m getting and error with show(p, notebook_handle=True), with show(p) it’s ok, using 0.12.3

May provide more details if necessary, error is below


-----------------------------------------------------------------------
ValueError                            Traceback (most recent call last)
<ipython-input-180-18380363c66d> in <module>()
----> 1 show(p, notebook_handle=True)
      2 # show(p)

/home/vagrant/anaconda3/lib/python3.5/site-packages/bokeh/io.py in show(obj, browser, new, notebook_handle)
    312     if obj not in _state.document.roots:
    313         _state.document.add_root(obj)
--> 314     return _show_with_state(obj, _state, browser, new, notebook_handle=notebook_handle)
    315 
    316 

/home/vagrant/anaconda3/lib/python3.5/site-packages/bokeh/io.py in _show_with_state(obj, state, browser, new, notebook_handle)
    322 
    323     if state.notebook:
--> 324         comms_handle = _show_notebook_with_state(obj, state, notebook_handle)
    325         shown = True
    326 

/home/vagrant/anaconda3/lib/python3.5/site-packages/bokeh/io.py in _show_notebook_with_state(obj, state, notebook_handle)
    348         if comms_target:
    349             handle = _CommsHandle(get_comms(comms_target), state.document,
--> 350                                   state.document.to_json())
    351             state.last_comms_handle = handle
    352             return handle

/home/vagrant/anaconda3/lib/python3.5/site-packages/bokeh/document.py in to_json(self)
    825         # this is a total hack to go via a string, needed because
    826         # our BokehJSONEncoder goes straight to a string.
--> 827         doc_json = self.to_json_string()
    828         return loads(doc_json)
    829 

/home/vagrant/anaconda3/lib/python3.5/site-packages/bokeh/document.py in to_json_string(self, indent)
    818         }
    819 
--> 820         return serialize_json(json, indent=indent)
    821 
    822     def to_json(self):

/home/vagrant/anaconda3/lib/python3.5/site-packages/bokeh/core/json_encoder.py in serialize_json(obj, encoder, indent, **kwargs)
     97         indent = 2
     98 
---> 99     return json.dumps(obj, cls=encoder, allow_nan=False, indent=indent, separators=separators, sort_keys=True, **kwargs)

/home/vagrant/anaconda3/lib/python3.5/json/__init__.py in dumps(obj, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, default, sort_keys, **kw)
    235         check_circular=check_circular, allow_nan=allow_nan, indent=indent,
    236         separators=separators, default=default, sort_keys=sort_keys,
--> 237         **kw).encode(obj)
    238 
    239 

/home/vagrant/anaconda3/lib/python3.5/json/encoder.py in encode(self, o)
    196         # exceptions aren't as detailed.  The list call should be roughly
    197         # equivalent to the PySequence_Fast that ''.join() would do.
--> 198         chunks = self.iterencode(o, _one_shot=True)
    199         if not isinstance(chunks, (list, tuple)):
    200             chunks = list(chunks)

/home/vagrant/anaconda3/lib/python3.5/json/encoder.py in iterencode(self, o, _one_shot)
    254                 self.key_separator, self.item_separator, self.sort_keys,
    255                 self.skipkeys, _one_shot)
--> 256         return _iterencode(o, 0)
    257 
    258 def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,

ValueError: Out of range float values are not JSON compliant

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

@Evgeny7777 there is no chance to be able to help diagnose a problem like this without much more information (OS, 32/64 bit, locale settings, etc.), as well as a complete code sample to reproduce it.

Most probably it was NaN in data indeed, worked after clean up. Thanks

Issue #2288 seems related.