TypeError:输入类型不支持ufunc'ndtri'

时间:2018-03-08 12:18:28

标签: python django python-2.7 scipy

如何解决以下错误?

我正在尝试calucalte normsINV值..但是当我在我的应用程序代码中使用它时面临问题

Internal Server Error: /reports/rschighlevel/
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/home/pulsedev2/prod/pulse.corp.uber.internal/ats/reports/views.py", line 167, in rschighlevel
    print norm.ppf(a)
  File "/usr/lib/python2.7/dist-packages/scipy/stats/distributions.py", line 1514, in ppf
    place(output, cond, self._ppf(*goodargs) * scale + loc)
  File "/usr/lib/python2.7/dist-packages/scipy/stats/distributions.py", line 2187, in _ppf
    return _norm_ppf(q)
  File "/usr/lib/python2.7/dist-packages/scipy/stats/distributions.py", line 2133, in _norm_ppf
    return special.ndtri(q)
TypeError: ufunc 'ndtri' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe'

这是我的代码:

from scipy.stats import norm
from scipy.special import ndtri
import pdb

        sigma = []
        for i in usigma:
            a = (1-i[6])
            print type(a)
            print norm.ppf(a) - Error Line
            sigma.append([i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7], a])
        print sigma

我使用Python 2.7和Django。

error message

0 个答案:

没有答案