8000 Fixes: np.asscalar should pass through scalars #4701 by liufei11111 · Pull Request #5133 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

Fixes: np.asscalar should pass through scalars #4701 #5133

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
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
rate==0.0 fix
  • Loading branch information
egscwebsite committed Sep 27, 2014
commit b3814d42386a4b51edf7c28ee87eb3e28842ae65
9 changes: 7 additions & 2 deletions numpy/lib/financial.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,13 @@ def pmt(rate, nper, pv, fv=0, when='end'):
temp = (1+rate)**nper
miter = np.broadcast(rate, nper, pv, fv, when)
zer = np.zeros(miter.shape)
fact = np.where(rate == zer, nper + zer,
(1 + rate*when)*(temp - 1)/rate + zer)
fact=zer
if rate==0.0:
fact=map(np.asarray,[nper + zer])
else:
fact=map(np.asarray,[(1 + rate*when)*(temp - 1)/rate + zer])
# fact = np.where(rate == 0.0, nper + zer,
# (1 + rate*when)*(temp - 1)/rate + zer)
return -(fv + pv*temp) / fact

def nper(rate, pmt, pv, fv=0, when='end'):
Expand Down
0