ranaroussi / quantstats

Portfolio analytics for quants, written in Python
Apache License 2.0
4.86k stars 847 forks source link

AttributeError: module 'numpy' has no attribute 'product' #365

Open justin8shan opened 4 weeks ago

justin8shan commented 4 weeks ago

numpy only has function as of np.prod instead of np.product Which version of numpy is np.product available in?

i-am-garden commented 2 weeks ago

I had a same issue. Just change line 96 in "stats.py" return _np.product(1 + returns) (1 / len(returns)) - 1 -> return _np.prod(1 + returns) (1 / len(returns)) - 1

then It'll work again.

antoniouaa commented 1 week ago

numpy.product was deprecated in numpy 1.25, with this PR and removed in numpy 2.x. This should be a quick and simple find all and replace, since np.prod has been around since at least numpy 1.7 and the requirements for this package ask for: https://github.com/ranaroussi/quantstats/blob/fa0a91a42400978bcc95f5f2fb2cf20e6f7af56c/requirements.txt#L2