Trendy icon indicating copy to clipboard operation
Trendy copied to clipboard

IndexError: boolean index did not match indexed array along dimension 0

Open dattran2346 opened this issue 4 years ago • 1 comments

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

dattran2346 avatar Dec 08 '19 11:12 dattran2346

Did you find a solution to this? Since I am encountering the same problem. @dysonance

just-a-normal-human avatar Aug 16 '20 17:08 just-a-normal-human