Skip to content

Commit df5af39

Browse files
committed
MAINT: Fix doctests for NumPy 2.0
1 parent b60399d commit df5af39

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

numpy_financial/_financial.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def pmt(rate, nper, pv, fv=0, when='end'):
245245
years at an annual interest rate of 7.5%?
246246
247247
>>> npf.pmt(0.075/12, 12*15, 200000)
248-
-1854.0247200054619
248+
np.float64(-1854.0247200054619)
249249
250250
In order to pay-off (i.e., have a future-value of 0) the $200,000 obtained
251251
today, a monthly payment of $1,854.02 would be required. Note that this
@@ -424,7 +424,7 @@ def ipmt(rate, per, nper, pv, fv=0, when='end'):
424424
425425
>>> interestpd = np.sum(ipmt)
426426
>>> np.round(interestpd, 2)
427-
-112.98
427+
np.float64(-112.98)
428428
429429
"""
430430
when = _convert_when(when)
@@ -562,7 +562,7 @@ def pv(rate, nper, pmt, fv=0, when='end'):
562562
interest rate is 5% (annually) compounded monthly.
563563
564564
>>> npf.pv(0.05/12, 10*12, -100, 15692.93)
565-
-100.00067131625819
565+
np.float64(-100.00067131625819)
566566
567567
By convention, the negative sign represents cash flow out
568568
(i.e., money not available today). Thus, to end up with
@@ -913,7 +913,7 @@ def npv(rate, values):
913913
914914
>>> rate, cashflows = 0.08, [-40_000, 5_000, 8_000, 12_000, 30_000]
915915
>>> np.round(npf.npv(rate, cashflows), 5)
916-
3065.22267
916+
np.float64(3065.22267)
917917
918918
It may be preferable to split the projected cashflow into an initial
919919
investment and expected future cashflows. In this case, the value of
@@ -923,7 +923,7 @@ def npv(rate, values):
923923
>>> initial_cashflow = cashflows[0]
924924
>>> cashflows[0] = 0
925925
>>> np.round(npf.npv(rate, cashflows) + initial_cashflow, 5)
926-
3065.22267
926+
np.float64(3065.22267)
927927
928928
The NPV calculation may be applied to several ``rates`` and ``cashflows``
929929
simulatneously. This produces an array of shape ``(len(rates), len(cashflows))``.
@@ -1005,7 +1005,7 @@ def mirr(values, finance_rate, reinvest_rate, *, raise_exceptions=False):
10051005
The project has a finance rate of 10% and a reinvestment rate of 12%.
10061006
10071007
>>> npf.mirr([-100, 50, -60, 70], 0.10, 0.12)
1008-
-0.03909366594356467
1008+
np.float64(-0.03909366594356467)
10091009
10101010
Now, let's consider the scenario where all cash flows are negative.
10111011

0 commit comments

Comments
 (0)