Skip to content

Commit

Permalink
Merge pull request #127 from Kai-Striega/maint/tidy-up-environment.yml
Browse files Browse the repository at this point in the history
MAINT: Tidy up environment.yml
  • Loading branch information
Kai-Striega authored Jul 6, 2024
2 parents 3263e71 + cb41ae4 commit f1a43fa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
activate-environment: numpy-financial-dev
activate-environment: npf-dev
environment-file: environment.yml
auto-activate-base: false
- name: Conda metadata
Expand Down
7 changes: 3 additions & 4 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# To use:
# $ conda env create -f environment.yml # `mamba` works too for this command
# $ conda activate numpy-financial-dev
# $ conda activate npf-dev
#
name: numpy-financial-dev
name: npf-dev
channels:
- conda-forge
dependencies:
# Runtime dependencies
- python
- numpy
- numpy>=2.0.0
# Build
- cython>=3.0.9
- compilers
Expand All @@ -20,7 +20,6 @@ dependencies:
# Tests
- pytest
- pytest-xdist
- asv>=0.6.0
- hypothesis
# Docs
- myst-parser
Expand Down
10 changes: 5 additions & 5 deletions numpy_financial/_financial.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def pmt(rate, nper, pv, fv=0, when='end'):
years at an annual interest rate of 7.5%?
>>> npf.pmt(0.075/12, 12*15, 200000)
-1854.0247200054619
np.float64(-1854.0247200054619)
In order to pay-off (i.e., have a future-value of 0) the $200,000 obtained
today, a monthly payment of $1,854.02 would be required. Note that this
Expand Down Expand Up @@ -424,7 +424,7 @@ def ipmt(rate, per, nper, pv, fv=0, when='end'):
>>> interestpd = np.sum(ipmt)
>>> np.round(interestpd, 2)
-112.98
np.float64(-112.98)
"""
when = _convert_when(when)
Expand Down Expand Up @@ -562,7 +562,7 @@ def pv(rate, nper, pmt, fv=0, when='end'):
interest rate is 5% (annually) compounded monthly.
>>> npf.pv(0.05/12, 10*12, -100, 15692.93)
-100.00067131625819
np.float64(-100.00067131625819)
By convention, the negative sign represents cash flow out
(i.e., money not available today). Thus, to end up with
Expand Down Expand Up @@ -913,7 +913,7 @@ def npv(rate, values):
>>> rate, cashflows = 0.08, [-40_000, 5_000, 8_000, 12_000, 30_000]
>>> np.round(npf.npv(rate, cashflows), 5)
3065.22267
np.float64(3065.22267)
It may be preferable to split the projected cashflow into an initial
investment and expected future cashflows. In this case, the value of
Expand All @@ -923,7 +923,7 @@ def npv(rate, values):
>>> initial_cashflow = cashflows[0]
>>> cashflows[0] = 0
>>> np.round(npf.npv(rate, cashflows) + initial_cashflow, 5)
3065.22267
np.float64(3065.22267)
The NPV calculation may be applied to several ``rates`` and ``cashflows``
simulatneously. This produces an array of shape ``(len(rates), len(cashflows))``.
Expand Down

0 comments on commit f1a43fa

Please sign in to comment.