AttributeError: module 'numpy' has no attribute 'product'
numpy only has function as of np.prod instead of np.product Which version of numpy is np.product available in?
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.
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
I am on numpy 2.1.3, Still getting same error
Since there are several thumbs up on the previous indicating folks are still having trouble, to reiterate:
You need to use a version less than 2.0 or switch the calls to np.prod as product doesn't exist in 2.0 or later.
Closing this issue as it's older than 2025 and has been specifically addressed in release 0.0.64. The numpy compatibility layer now handles deprecated functions like np.product → np.prod.