You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I also ran into this, this happens because many operations shift rows causing the initial row to become NA.
To fix it, on those operations just .fillna(0) which shouldn't matter much as it will affect only the first row of calculations.
Code:
ta_all_indicators_df = ta.add_all_ta_features(ohlc[["open","high","low","close","volume"]], open="open", high="high",
low="low", close="close", volume="volume", fillna=True)
Error:
File ~/anaconda3/envs/bayes5/lib/python3.10/site-packages/ta/wrapper.py:96, in add_volume_ta(df, high, low, close, volume, fillna, colprefix, vectorized)
91 df[f"{colprefix}volume_adi"] = AccDistIndexIndicator(
92 high=df[high], low=df[low], close=df[close], volume=df[volume], fillna=fillna
93 ).acc_dist_index()
95 # On Balance Volume
---> 96 df[f"{colprefix}volume_obv"] = OnBalanceVolumeIndicator(
97 close=df[close], volume=df[volume], fillna=fillna
98 ).on_balance_volume()
100 # Chaikin Money Flow
101 df[f"{colprefix}volume_cmf"] = ChaikinMoneyFlowIndicator(
102 high=df[high], low=df[low], close=df[close], volume=df[volume], fillna=fillna
103 ).chaikin_money_flow()
File ~/anaconda3/envs/bayes5/lib/python3.10/site-packages/ta/volume.py:83, in OnBalanceVolumeIndicator.init(self, close, volume, fillna)
81 self._volume = volume
82 self._fillna = fillna
---> 83 self._run()
File ~/anaconda3/envs/bayes5/lib/python3.10/site-packages/ta/volume.py:86, in OnBalanceVolumeIndicator._run(self)
85 def _run(self):
---> 86 obv = np.where(self._close < self._close.shift(1), -self._volume, self._volume)
87 self._obv = pd.Series(obv, index=self._close.index).cumsum()
File missing.pyx:392, in pandas._libs.missing.NAType.bool()
TypeError: boolean value of NA is ambiguous
The text was updated successfully, but these errors were encountered: