breakout_candles= []
for _,breakout in btc_breakouts:
breakout_candles.append(breakout)
print(breakout_candles)
output:
[Timestamp('2021-10-28 04:00:00+0000', tz='UTC'), Timestamp('2021-10-28 08:00:00+0000', tz='UTC'), Timestamp('2021-10-29 08:00:00+0000', tz='UTC'), Timestamp('2021-10-31 16:00:00+0000', tz='UTC'), Timestamp('2021-11-01 04:00:00+0000', tz='UTC')]
Now im trying to set a value to 1 if the date was found in breakout_candles otherwise -1:
df['BTCgtRES'] = np.where((df['date'] in breakout_candles),1,-1)
but i m getting the ambiguous error:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
i also tried this, it compiles but does nothing it has to do:
df['BTCgtRES'] = np.where((df['date'].eq (breakout in breakout_candles)),1,-1)
You can try using isin() instead of in
df['BTCgtRES'] = np.where((df['date'].isin(breakout_candles)),1,-1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With