-
Notifications
You must be signed in to change notification settings - Fork 217
Description
When running the tutorial5.py script it gives the error message below.
I suspect it is because of numpy version 1.8.2 but I'm not sure.
Changing the line
if f_x >= 0:
to
if f_x.item() >= 0:
Seems to fix the problem
Traceback (most recent call last):
File "tutorial5.py", line 92, in
main()
File "tutorial5.py", line 82, in main
i_target_leverage=1, f_rate_borrow=3.5, log="transaction.csv")
File "/usr/local/lib/python2.7/dist-packages/QSTK-0.2.8-py2.7.egg/QSTK/qstksim/tradesim.py", line 304, in tradesim
prediction_shares = prediction_shares.apply(_nearest_interger)
File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 3596, in apply
return self._apply_standard(f, axis, reduce=reduce)
File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 3686, in _apply_standard
results[i] = func(v)
File "/usr/local/lib/python2.7/dist-packages/QSTK-0.2.8-py2.7.egg/QSTK/qstksim/tradesim.py", line 132, in _nearest_interger
if f_x >= 0:
File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 698, in nonzero
.format(self.class.name))
ValueError: ('The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().', u'occurred at index AAPL')