numpy.npv() in Python (original) (raw)
Last Updated : 17 May, 2022
numpy.npv(rate, value) : This financial function helps user to calculate the NPV(Net Present Value) of a cash flow series.
Parameters :
rate : [scalar] Rate of discount value : [array_like, shape(M,)] value of cash flows time series. The (fixed) time interval between cash flow “events” must be the same as that for given rate is given. By convention, investments or “deposits” are -ve, income or “withdrawals” are +ve
Return :
present value as per given parameters.
Equation being solved :
Code 1 : Working
Python
import
numpy as np
a
=
np.npv(
0.281
,[
-
100
,
19
,
49
,
58
,
200
])
print
("Net Present Value(npv) : ", a)
Output :
Net Present Value(npv) : 46.5579792365
References : https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.npv.html .
Similar Reads
- numpy.nper() in Python numpy.pmt(rate, pmt, pv, fv, when = ‘end’) : This financial function helps user to compute number of periodic payments. Parameters : rate : [scalar or (M, )array] Rate of interest as decimal (not per cent) per period pmt : [scalar or (M, )array] Payment value fv : [scalar or (M, )array] Future value 2 min read
- numpy.nanvar() in Python numpy.nanvar(arr, axis = None) : Compute the variance of the given data (array elements) along the specified axis(if any), while ignoring NaN values. Example : x = 1 1 1 1 1 Standard Deviation = 0 . Variance = 0 y = 9, 2, 5, 4, 12, 7, 8, 11, 9, 3, 7, 4, 12, 5, 4, 10, 9, 6, 9, 4 Step 1 : Mean of dist 3 min read
- numpy.invert() in Python numpy.invert() function is used to Compute the bit-wise Inversion of an array element-wise. It computes the bit-wise NOT of the underlying binary representation of the integers in the input arrays. For signed integer inputs, the two’s complement is returned. In a two’s-complement system negative num 2 min read
- numpy.ipmt() in Python numpy.ipmt(rate, nper, pv, fv, when = ‘end’) : This financial function helps user to compute payment value as per the interest only. i.e. returns the interest part. Parameters : rate : [scalar or (M, )array] Rate of interest as decimal (not per cent) per period nper : [scalar or (M, )array] total co 2 min read
- numpy.nanprod() in Python numpy.nanprod() function is used when we want to compute the product of array elements over a given axis treating NaNs as ones. One is returned for slices that are all-NaN or empty. Syntax : numpy.nanprod(arr, axis=None, dtype=None, out=None, keepdims='class numpy._globals._NoValue'). Parameters : a 2 min read
- numpy.isnan() in Python The numpy.isnan() function tests element-wise whether it is NaN or not and returns the result as a boolean array. Syntax : numpy.isnan(array [, out]) Parameters : array : [array_like]Input array or object whose elements, we need to test for infinity out : [ndarray, optional]Output array placed with 2 min read
- numpy.inner() in python numpy.inner(arr1, arr2): Computes the inner product of two arrays. Parameters : arr1, arr2 : array to be evaluated. Return: Inner product of the two arrays. Code #1 : # Python Program illustrating # numpy.inner() method import numpy as geek # Scalars product = geek.inner(5, 4) print("inner Prod 1 min read
- numpy.any() in Python The numpy.any() function tests whether any array elements along the mentioned axis evaluate to True. Syntax : numpy.any(a, axis = None, out = None, keepdims = class numpy._globals._NoValue at 0x40ba726c) Parameters : array :[array_like]Input array or object whose elements, we need to test. axis : [i 3 min read
- numpy.negative() in Python numpy.negative() function is used when we want to compute the negative of array elements. It returns element-wise negative value of an array or negative value of a scalar. Syntax : numpy.negative(arr, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, ext 2 min read
- numpy.log() in Python The numpy.log() is a mathematical function that helps user to calculate Natural logarithm of x where x belongs to all the input array elements. Natural logarithm log is the inverse of the exp(), so that log(exp(x)) = x. The natural logarithm is log in base e. Syntax :numpy.log(x[, out] = ufunc 'log1 4 min read