Trendy
Trendy copied to clipboard
IndexError: boolean index did not match indexed array along dimension 0
Hi @dysonance,
When I do
# find trend on closing price
trendy.minitrends(ohlc.c, window=30, charts=True)
I get the following error IndexError: boolean index did not match indexed array along dimension 0
.
143 # Find whether max's or min's
--> 144 maxi = (y[x[crit]] - y[x[crit] + window] > 0) & \
145 (y[x[crit]] - y[x[crit] - window] > 0) * 1
Let say n = len(ohlc.c), so in the function minitrends
, x
and y
have shape (n, ), but crit
has shape (n-window-1,). I think this is because numpy has evolved since you wrote the package. Can you provide a more modern implementation for these line of code?
My environment is:
python 3.6.9
numpy 1.16.4
Did you find a solution to this? Since I am encountering the same problem. @dysonance