Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #94750

Re: How to Calculate NPV?

Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'scipy': 0.05; 'wednesday,': 0.07; 'subject:How': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'wrong,': 0.09; 'python': 0.10; 'jan': 0.11; 'output': 0.13; 'file,': 0.15; 'things.': 0.15; 'display,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'snippets': 0.16; 'wrote:': 0.16; '2015': 0.20; 'function,': 0.22; 'trying': 0.22; 'am,': 0.23; 'code.': 0.23; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'all.': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'define': 0.27; 'idea': 0.28; 'sure,': 0.29; "i'm": 0.30; 'code': 0.30; "can't": 0.32; 'though,': 0.32; 'run': 0.33; 'running': 0.34; 'gets': 0.35; 'but': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'doing': 0.38; "won't": 0.38; 'why': 0.39; "didn't": 0.39; 'rather': 0.39; 'to:addr:python.org': 0.40; 'easy': 0.60; 'show': 0.62; 'further': 0.62; 'sample': 0.63; 'benefit': 0.66; 'book.': 0.72; 'obvious': 0.76; '2.7.': 0.84; 'utc-4,': 0.84; 'received:fios.verizon.net': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: How to Calculate NPV?
Date Wed, 29 Jul 2015 15:08:25 -0400
References <249a5b7e-0364-4b74-94f4-c8bbfbba2479@googlegroups.com> <757d1a56-fc27-4996-acff-8bb7e07204d6@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-98-114-97-173.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0
In-Reply-To <757d1a56-fc27-4996-acff-8bb7e07204d6@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1079.1438196929.3674.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1438196929 news.xs4all.nl 2857 [2001:888:2000:d::a6]:45408
X-Complaints-To abuse@xs4all.nl
Path csiph.com!usenet.pasdenom.info!news.stben.net!border1.nntp.ams1.giganews.com!border2.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Xref csiph.com comp.lang.python:94750

Show key headers only | View raw


On 7/29/2015 10:21 AM, ryguy7272 wrote:
> On Wednesday, July 29, 2015 at 9:59:10 AM UTC-4, ryguy7272 wrote:
>> I am using Spyder Python 2.7.  I'm running this sample code.
>>
>> import scipy as sp
>> cashflows=[50,40,20,10,50]
>> npv=sp.npv(0.1,cashflows)
>> round(npv,2)
>>
>>
>> Now, I'm trying to get the NPV, and I don't see any obvious way to get it.
>> The author of the book that I'm reading gets 144.56.  I think that's wrong, but I don't know for sure, as Python won't do any calculation at all.  It's easy to enter code and run it, but I can't tell how to get Python to actually DO the calculation.
>>
>> Any idea what I'm doing wrong?
>
> PERFECT!!  SO SIMPLE!!
> I don't know why the author didn't do that in the book.

The book show you how to calculate things.  It is up to you to display, 
output to a file, or use in further calculation.  I do admit, though, 
that snippets that show how to use an existing function, rather than 
define a new function, might benefit from adding print(xxxx).

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to Calculate NPV? ryguy7272 <ryanshuell@gmail.com> - 2015-07-29 06:58 -0700
  Re: How to Calculate NPV? Saber Ayoub Chelaghma <saber.chelaghma@gmail.com> - 2015-07-29 07:09 -0700
  Re: How to Calculate NPV? ryguy7272 <ryanshuell@gmail.com> - 2015-07-29 07:21 -0700
    Re: How to Calculate NPV? ryguy7272 <ryanshuell@gmail.com> - 2015-07-29 07:27 -0700
      Re: How to Calculate NPV? duncan smith <buzzard@invalid.invalid> - 2015-07-29 17:14 +0100
    Re: How to Calculate NPV? Terry Reedy <tjreedy@udel.edu> - 2015-07-29 15:08 -0400
    Re: How to Calculate NPV? Dave Farrance <df@see.replyto.invalid> - 2015-07-30 15:18 +0100

csiph-web