Python Forum
'function' object does not support item assignment
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'function' object does not support item assignment
#3
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-17-150efdede077> in <module>()
     39 
     40 z0 = [0.01, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]
---> 41 z = fsolve(ss, z0)
     42 
     43 print('Numerical x*', z[0])

E:\Anaconda3\lib\site-packages\scipy\optimize\minpack.py in fsolve(func, x0, args, fprime, full_output, col_deriv, xtol, maxfev, band, epsfcn, factor, diag)
    144                'diag': diag}
    145 
--> 146     res = _root_hybr(func, x0, args, jac=fprime, **options)
    147     if full_output:
    148         x = res['x']

E:\Anaconda3\lib\site-packages\scipy\optimize\minpack.py in _root_hybr(func, x0, args, jac, col_deriv, xtol, maxfev, band, eps, factor, diag, **unknown_options)
    210     if not isinstance(args, tuple):
    211         args = (args,)
--> 212     shape, dtype = _check_func('fsolve', 'func', func, x0, args, n, (n,))
    213     if epsfcn is None:
    214         epsfcn = finfo(dtype).eps

E:\Anaconda3\lib\site-packages\scipy\optimize\minpack.py in _check_func(checker, argname, thefunc, x0, args, numinputs, output_shape)
     24 def _check_func(checker, argname, thefunc, x0, args, numinputs,
     25                 output_shape=None):
---> 26     res = atleast_1d(thefunc(*((x0[:numinputs],) + args)))
     27     if (output_shape is not None) and (shape(res) != output_shape):
     28         if (output_shape[0] != 1):

<ipython-input-17-150efdede077> in ss(z)
     24     I = z[10]
     25 
---> 26     ss[0] = x - m
     27     ss[1] = 1 + ((r_k-1) * (beta*psi-1)) / (beta * ((1-delta) + (1-r_k) *r_b *psi))
     28     ss[2] = b - (1-delta) * k + (1-delta)**T * I

TypeError: 'function' object does not support item assignment
Reply


Messages In This Thread
RE: 'function' object does not support item assignment - by Mahdi1994 - Apr-04-2018, 12:16 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  What is the mechanism of numpy function returning pandas object? Ibaraki 2 2,532 Apr-04-2020, 10:57 PM
Last Post: Ibaraki

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020