如何在jupyter笔记本中解决“ TypeError ufunc'isfinite'”

时间:2019-08-20 01:56:23

标签: python-3.x jupyter-notebook

我有关于类型的错误。它来自储料器。我不知道代码错误在哪里

环境: python 3.7 numpy和其他libray是最新的

TypeError                                 Traceback (most recent call last)
<ipython-input-6-00eba8b188be> in <module>
----> 3 amazon.changepoint_prior_analysis(changepoint_priors=[0.001, 0.01, 0.06, 0.2])

~\Desktop\master\stocker.py in changepoint_prior_analysis(self, changepoint_priors, colors)
    427             ax.fill_between(predictions['ds'].dt.to_pydatetime(), predictions['%.3f_yhat_upper' % prior],
    428                             predictions['%.3f_yhat_lower' % prior], facecolor = color_dict[prior],
--> 429                             alpha = 0.3, edgecolor = 'k', linewidth = 0.6)
    430 
    431         # Plot labels

~\AppData\Roaming\Python\Python37\site-packages\matplotlib\__init__.py in inner(ax, data, *args, **kwargs)
   1599     def inner(ax, *args, data=None, **kwargs):
   1600         if data is None:
-> 1601             return func(ax, *map(sanitize_sequence, args), **kwargs)
   1602 
   1603         bound = new_sig.bind(ax, *args, **kwargs)

~\AppData\Roaming\Python\Python37\site-packages\matplotlib\axes\_axes.py in fill_between(self, x, y1, y2, where, interpolate, step, **kwargs)
   5222 
   5223         # Convert the arrays so we can work with them
-> 5224         x = ma.masked_invalid(self.convert_xunits(x))
   5225         y1 = ma.masked_invalid(self.convert_yunits(y1))
   5226         y2 = ma.masked_invalid(self.convert_yunits(y2))

~\AppData\Roaming\Python\Python37\site-packages\numpy\ma\core.py in masked_invalid(a, copy)
   2364         cls = type(a)
   2365     else:
-> 2366         condition = ~(np.isfinite(a))
   2367         cls = MaskedArray
   2368     result = a.view(cls)

TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

我希望显示完整的图表,但现在实际缺少一些事件。

1 个答案:

答案 0 :(得分:0)

我很久以前就遇到过类似的问题。我正在分享链接。希望对您有帮助。Link1 link2