Closed distagon closed 2 years ago
following works: pivots = peak_valley_pivots(X.values, 0.2, -0.2)
So, peak_valley_pivots() input must be np.array, can't be pandas series?
Yes. I remember that happening at some point, and I never fixed it.
The X.values
hack works for now. But, I'm going to keep this open. I think this code needs a refactor, in general.
0.3.0
now allows you to just call peak_valley_pivots
with the pd.Series
object
pandas ver. 0.19.2
code: IBB = data.get_data_yahoo('IBB') X = IBB['Adj Close'] pivots = peak_valley_pivots(X, 0.2, -0.2) ts_pivots = pd.Series(X, index=X.index) ts_pivots = ts_pivots[pivots != 0] X.plot() ts_pivots.plot(style='g-o')
error msg: TypeError Traceback (most recent call last)