pygal icon indicating copy to clipboard operation
pygal copied to clipboard

pygal.Line() render_to_file: OverflowError: cannot convert float infinity to integer

Open clintolsen opened this issue 5 years ago • 1 comments

I'm still trying to isolate a testcase, but I'm seeing this with a particular dataset:

File "/opt/local/python-3.6.1/lib/python3.6/site-packages/pygal/graph/public.py", line 114, in render_to_file
    f.write(self.render(is_unicode=True, **kwargs))
  File "/opt/local/python-3.6.1/lib/python3.6/site-packages/pygal/graph/public.py", line 52, in render 
    self.setup(**kwargs)
  File "/opt/local/python-3.6.1/lib/python3.6/site-packages/pygal/graph/base.py", line 217, in setup 
    self._draw()
  File "/opt/local/python-3.6.1/lib/python3.6/site-packages/pygal/graph/graph.py", line 926, in _draw 
    self._compute_y_labels()
  File "/opt/local/python-3.6.1/lib/python3.6/site-packages/pygal/graph/graph.py", line 853, in _compute_y_labels
    self.order_min, self.min_scale, self.max_scale
  File "/opt/local/python-3.6.1/lib/python3.6/site-packages/pygal/util.py", line 163, in compute_scale
    order = round(log10(max(abs(min_), abs(max_)))) - 1
OverflowError: cannot convert float infinity to integer

clintolsen avatar Apr 11 '19 21:04 clintolsen

FYI, this does appear to be an input data issue. I was plotting data from pandas, and one of the cells was inf causing this error. I'm not sure if something more graceful can be done here.

clintolsen avatar Apr 11 '19 21:04 clintolsen