TA Stochastic indicator calculation error: The truth value of a DataFrame is ambiguous

Viewed 19

I try to calculate a stochastic indicator

import pandas as pd
import sys
import ta    

highprices = pd.DataFrame([1111, 1112, 1114, 1116, 1118, 1119, 1130, 1140, 1160])
lowprices = pd.DataFrame([999, 1000, 1100, 1111, 1100, 1100, 1100, 1100, 1110])
lastprices = pd.DataFrame([1110, 1110, 1110, 1110, 1111, 1111, 1111, 1111, 1111])
slowk = ta.momentum.stoch(highprices, lowprices, lastprices,  3,  1)
slowd = slowk.rolling(3).mean()
print(slowk, slowd)
sys.exit()

But it gives me

ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

Am I doing something wrong?

0 Answers
Related