numpy.npv() in Python Last Updated : 17 May, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 ## Python program explaining npv() function import numpy as np # rate values 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 . Comment More infoAdvertise with us Next Article numpy.ipmt() in Python M mohit gupta_omg :) Follow Improve Article Tags : Python Python-numpy Python numpy-Financial Functions Practice Tags : python Similar Reads 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.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 computes the product of array elements over a given axis while treating NaN (Not a Number) values as 1 (i.e., ignoring them in the product). Example:Pythonimport numpy as np a = np.array([1.0, 2.0, np.nan, 4.0]) res = np.nanprod(a) print(res)Output8.0 Explanation: np.nanprod 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 wit 2 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 : 3 min read numpy.nansum() in Python numpy.nansum() function computes the sum of array elements over a given axis, treating NaN (Not a Number) values as zero. This is useful when you want to ignore missing or undefined values in your computation. For Example:Pythonimport numpy as np a = np.array([1.0, 2.0, np.nan, 4.0]) res = np.nansum 2 min read Like