IRR库只有在支付期限和复利期限以年为单位的情况下才是好的(工程经济) [英] IRR library is only good if the pay period and compound period is in years (Engineering Economy)

查看:133
本文介绍了IRR库只有在支付期限和复利期限以年为单位的情况下才是好的(工程经济)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://docs.scipy. org/doc/numpy-1.10.0/reference/generation/numpy.irr.html

仅当付款期限和复利期限以年为单位时,以上链接才对我有用.如果他们几个月或一个季度,我不知道如何使用它.

The link above works for me only when the pay period and compound period are in years. If they in months or quarters, I don't know how to use it.

如果您对IRR,现值,未来值等有所了解,您将理解我的意思.

You will understand what I am saying, if you have knowledge about IRR, present value, future value, etc.

IRR(年)的答案是298.88%,而我得到的是12.22%

The answer for IRR(Year) is 298.88% and I am getting 12.22%

A列中的时间以年为单位

The time in column A is in years

EXCEL FILE IMAGE: Excel文件图像

EXCEL FILE IMAGE: Excel File image

import xlrd
import numpy

fileWorkspace = 'C://Users/jod/Desktop/'

wb1 = xlrd.open_workbook(fileWorkspace + 'Project3.xls')
sh1 = wb1.sheet_by_index(0)

time,amount,category = [],[],[]
for a in range(2,sh1.nrows):
    time.append(int(sh1.cell(a,0).value))
    amount.append(float(sh1.cell(a,1).value))
    category.append(str(sh1.cell(a,2).value))
#print(time)
#print(amount)
#print(category)
print('\n')

p_p2 = str(sh1.cell(0,1))
p_p1 = p_p2.replace("text:'","")
pp = p_p1.replace("'","")
#print(pp)
c_p2 = str(sh1.cell(1,1))
c_p1 = c_p2.replace("text:'","")
cp = c_p1.replace("'","")
#print(cp)

netflow = 0
outflow = 0
inflow = 0
flow = 0
if pp == "Months" and cp == "Months":

    IRR = numpy.irr(amount) * 100
    print ("IRR:", round(IRR, 2), '%', '\n')

    for i in time: 
        flow = amount[i] / numpy.power((1 + (IRR/100)), time[i])
        if flow>0:                      
            inflow = inflow + flow      
        if flow<0:                      
            outflow = outflow + flow   

        #print ('Present Value (P) is:', round(flow,0), '\n')

    netflow = outflow + inflow
    print("In 2016")
    print("-------")
    print ('Outflow is: ', round(outflow,0))
    print ('Inflow is: ', round(inflow,0))
    print ('Netflow is: ', round(netflow,0), '\n')

    outflow2 = (round(outflow,0))*(1+(IRR/100))**(9)
    inflow2 = (round(inflow,0))*(1+(IRR/100))**(9)
    netflow2 = outflow2 + inflow2

    print("In 2025")
    print("-------")
    print ('Outflow is: ', round(outflow2,0))
    print ('Inflow is: ', round(inflow2,0))
    print ('Netflow is: ', round(netflow2,0), '\n')

推荐答案

让我们假设我们有每月流量,例如:

Let us assume we have a monthly flow, for example:

flow = [-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.4]
x = np.irr(flow)
x
0.0284361557263606

要计算IRR,您需要使用以下公式: 内部收益率=(1 + x)** 12-1

to compute IRR you need to use the following formula: IRR = (1 + x)**12 - 1

(1 + x) ** 12 - 1
0.39999999999998925

如果您有季度流量,请相应地使用公式:

If you have quarterly flow, use the formula acordingly:

IRR =(1 + np.irr(quarterly_flow))** 4-1-

IRR = (1 + np.irr(quarterly_flow)) ** 4 - 1

这篇关于IRR库只有在支付期限和复利期限以年为单位的情况下才是好的(工程经济)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆