Closed kartiksubbarao closed 7 months ago
Ok thank you. I’ll accept the PR when you submit it. Thanks for your contributions!
Robert Grzesik 347-635-3416
On Fri, Feb 23, 2024 at 4:58 PM Kartik Subbarao @.***> wrote:
The expected_return() function in stats.py has deprecated code, which causes the following warning when generating a tearsheet with a benchmark:
/path/to/python/lib/python3.12/site-packages/numpy/core/fromnumeric.py:86: FutureWarning: The behavior of DataFrame.prod with axis=None is deprecated, in a future version this will reduce over both axes and return a scalar. To retain the old behavior, pass axis=0 (or do not pass axis) return reduction(axis=axis, out=out, **passkwargs)
Here is the deprecated code:
return _np.product(1 + returns) ** (1 / len(returns)) - 1
The corrected version is this:
return _np.prod(1 + returns, axis=0) ** (1 / len(returns)) - 1
In addition to explicitly specifying axis=1 to fix the FutureWarning, it also changes _np.product to _np.prod to fix another deprecation issue:
https://github.com/numpy/numpy/blob/maintenance/1.26.x/numpy/core/fromnumeric.py#L3837-L3839
I will submit a pull request.
— Reply to this email directly, view it on GitHub https://github.com/Lumiwealth/quantstats_lumi/issues/11, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIYQKZUVMCLJYYVVFK5A2TYVEGHDAVCNFSM6AAAAABDXMX242VHI2DSMVQWIX3LMV43ASLTON2WKOZSGE2TCOBWHAZTQMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Ahh -- I created the patch and didn't remember to actually create the pull request :-) Should be visible now.
Ok merged and deployed v0.1.4
Robert Grzesik 347-635-3416
On Fri, Feb 23, 2024 at 7:16 PM Kartik Subbarao @.***> wrote:
Ahh -- I created the patch and didn't remember to actually create the pull request :-) Should be visible now.
— Reply to this email directly, view it on GitHub https://github.com/Lumiwealth/quantstats_lumi/issues/11#issuecomment-1962164713, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIYQK7XZJMDNPBGLUJGKSTYVEWOPAVCNFSM6AAAAABDXMX242VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRSGE3DINZRGM . You are receiving this because you commented.Message ID: @.***>
The expected_return() function in stats.py has deprecated code, which causes the following warning when generating a tearsheet with a benchmark:
Here is the deprecated code:
The corrected version is this:
In addition to explicitly specifying axis=0 to fix the FutureWarning, it also changes _np.product to _np.prod to fix another deprecation issue: https://github.com/numpy/numpy/blob/maintenance/1.26.x/numpy/core/fromnumeric.py#L3837-L3839
I will submit a pull request.