-2

I am trying to use scipy.optimize spo, and keep on getting error " 'numpy.float64' object is not callable". Could anyone point me to where the error is coming from? TIA!

enter image description here

vethraut
  • 35
  • 5
  • 3
    Please share your code as formatted text, not an image. Also, if you can share the full traceback that would also help – Mureinik Sep 12 '21 at 18:13
  • it's coming from your code!. You must be using a float (number) where `minimize` expects a function. But you have the code and full error message; we don't – hpaulj Sep 12 '21 at 19:39

1 Answers1

0

The first argument of scipy.optimize.minimize is a call able, and you seem to give it a function value instead. In the OP screenshot, what is -sharpe_ratio. You might be looking for lambda x, prices_norm : -sharpe_ratio(x, prices_norm) or some such.

ev-br
  • 24,968
  • 9
  • 65
  • 78