【问题标题】:how can I solve "TypeError ufunc 'isfinite'" in jupyter notebook如何解决 jupyter notebook 中的“TypeError ufunc 'isfinite'”
【发布时间】:2019-12-25 04:58:52
【问题描述】:

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

环境: 蟒蛇3.7 numpy 和其他库是最新的

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''

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

【问题讨论】:

    标签: python-3.x jupyter-notebook


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2021-06-29
      • 2020-09-29
      • 2022-07-12
      • 2022-01-22
      • 1970-01-01
      • 2020-02-16
      • 1970-01-01
      • 2020-05-15
      • 1970-01-01
      相关资源
      最近更新 更多