May-16-2020, 04:48 PM
(May-15-2020, 10:04 PM)snippsat Wrote: Try.
#return pd.isnull(self._tlog).any(1).nonzero()[0] return pd.isnull(self._tlog).any(1).to_numpy().nonzero()[0]A other option had to been running in a virtual environment.
Then clone Repo and install requirements.txt
git clone https://github.com/fja05680/pinkfish.git pip install -r requirements.txtNow will running with versions that was used when this was made.
Thank you very much for your time.
I tried
return pd.isnull(self._tlog).any(1).to_numpy().nonzero()[0]
still have error message
Error:---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-81-56c406d527ea> in <module>
10 shares = tlog.exit_trade(date, close)
11 # buy
---> 12 elif (tlog.num_open_trades() == 0
13 and row.macd_fast > row.macd_slow and data['diff fast'][i-1] <= data['slow singal'][i-1]):
14
D:\programs\anaconda3\lib\site-packages\pinkfish\trade.py in num_open_trades(self)
54 def num_open_trades(self):
55 """ return number of open orders, i.e. not closed out """
---> 56 return len(self._get_open_trades())
57
58 def exit_trade(self, exit_date, exit_price, shares=-1, long_short='long'):
D:\programs\anaconda3\lib\site-packages\pinkfish\trade.py in _get_open_trades(self)
50 def _get_open_trades(self):
51 """ find the "integer" index of rows with NaN """
---> 52 return pd.isnull(self._tlog).any(1).to_numpy().nonzero()[0]
53
54 def num_open_trades(self):
D:\programs\anaconda3\lib\site-packages\pandas\core\generic.py in __getattr__(self, name)
5272 if self._info_axis._can_hold_identifiers_and_holds_name(name):
5273 return self[name]
-> 5274 return object.__getattribute__(self, name)
5275
5276 def __setattr__(self, name: str, value) -> None:
AttributeError: 'Series' object has no attribute 'nonzero'
I tried nonempty to replace nonzero still not working. I also tried to downgrade the pandas to 0.24.2. then I ran into so many other error codes on my existing code.
so a downgrade pandas is not a good option I think.
I was reading at pandas.pydata.org, didn't see much info regarding to_numpy().nonzero()[0]
is there any alternative ?