-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
np.pmt causing unnecessary warnings #5046
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
what a strange function to have in numpy.. |
The financial functions showed up one year around the (US) tax date. I think there is a connection ;) |
needs a errstate(division='ignore') as where evaluates both conditions |
This issue also exists within fv() |
…rameters passed in to np.where() is evaluated first before going into the function however, the denominator can be zero at that time. I allocated the intermediate result based on different formulas for rate == 0.0 and not equal to and fixes numpy#5046. Also, a easy fix for asocial doesn’t take integer because it assumes passing in an np.array. I convert everything to np.array first and then retrieve the item. Fixed numpy#4701
Previous implementation would cause divide by zero and hence warning since "fact" variable was calculated for all rates (both zero and non-zero) but then zero rates would be masked with a where equality. Changed implementation to apply non-zero rates using "np.divide( numerator, denominator, where=mask_of_zero_values)"and then apply zero rates with "np.copyto". Also updated documentation to show exact formulas that are being calculated. Done with help of Sebastian Berg in Austin,TX! Fixes issue numpy#5046
Previous implementation would cause divide by zero and hence warning since "fact" variable was calculated for all rates (both zero and non-zero) but then zero rates would be masked with a where equality. Changed implementation to apply non-zero rates using "np.divide( numerator, denominator, where=mask_of_zero_values)"and then apply zero rates with "np.copyto". Also updated documentation to show exact formulas that are being calculated. Done with help of Sebastian Berg in Austin,TX! 7/13/15 Added in parenthesis for reability per Nathaniel Smith comment e.g. zero_rate_mask = (rate == 0) Fixes issue numpy#5046
was this fixed? |
Can you tell which python, numpy version and which OS you are using while running this command. |
Closing. I note that #6073 is still open. |
I think that should be closed too. It tries to fix the same issue (this one) also the last comment (#6073 (comment)) is nearly three years old:
I think we won't see further changes any time soon. |
Sometimes when using the np.pmt I enter 0.0 as an interest rate like so:
According to the documentation at http://docs.scipy.org/doc/numpy/reference/generated/numpy.pmt.html there is no restriction against a rate of 0 and the notes section in the docs even address the use case where rate = 0.
Yet every time I run the function with rate set to 0.0 I get the following warning:
I looked at the source and understand why its throwing the warning, but it really shouldn't since 0 is a valid rate and should handle that case differently.
The text was updated successfully, but these errors were encountered: