8000 np.pmt causing unnecessary warnings · Issue #5046 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

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

Closed
alkarimlalani opened this issue Sep 4, 2014 · 9 comments
Closed

np.pmt causing unnecessary warnings #5046

alkarimlalani opened this issue Sep 4, 2014 · 9 comments

Comments

@alkarimlalani
Copy link

Sometimes when using the np.pmt I enter 0.0 as an interest rate like so:

np.pmt(0.0, 180, 20000)

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:

Warning: invalid value encountered in double_scalars

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.

@argriffing
Copy link
Contributor

what a strange function to have in numpy..

@charris
Copy link
Member
charris commented Sep 4, 2014

The financial functions showed up one year around the (US) tax date. I think there is a connection ;)

@juliantaylor
Copy link
Contributor

needs a errstate(division='ignore') as where evaluates both conditions
top level access should probably also be deprecated like irr

@m0thy
Copy link
m0thy commented Sep 27, 2014

This issue also exists within fv()

liufei11111 added a commit to liufei11111/numpy that referenced this issue Nov 7, 2014
…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
githubmlai added a commit to githubmlai/numpy that referenced this issue Jul 13, 2015
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
githubmlai added a commit to githubmlai/numpy that referenced this issue Jul 13, 2015
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
@jomv1
Copy link
jomv1 commented Mar 28, 2019

was this fixed?

@RuchikaChugh
Copy link

Sometimes when using the np.pmt I enter 0.0 as an interest rate like so:

np.pmt(0.0, 180, 20000)

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:

Warning: invalid value encountered in double_scalars

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.

Can you tell which python, numpy version and which OS you are using while running this command.

@Kai-Striega
Copy link
Member

@charris pr-5577 fixed this. I think this issue should be closed.

@charris
Copy link
Member
charris commented Jun 29, 2019

Closing. I note that #6073 is still open.

@charris charris closed this as completed Jun 29, 2019
@Kai-Striega
Copy link
Member
Kai-Striega commented Jun 29, 2019

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:

☔️ The latest upstream changes (presumably #8050) made this pull request unmergeable. Please resolve the merge conflicts.

I think we won't see further changes any time soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants
0