June 2015
Beginner
348 pages
8h 44m
English
We will calculate the net present value for a random generated cash flow series:
-100 as the start value:cashflows = np.random.randint(100, size=5)
cashflows = np.insert(cashflows, 0, -100)
print("Cashflows", cashflows)The cash flows would be as follows:
Cashflows [-100 38 48 90 17 36]
npv() function to calculate the net present value from the cash flow series we generated in the previous step. Use a rate of 3 percent:print("Net present value", np.npv(0.03, cashflows))The net present value:
Net present value 107.435682443
We computed the net present value from a random generated cash flow series with the ...
Read now
Unlock full access