<div dir="ltr">+1 on removing them from NumPy. I think there are plenty of alternatives already so many that we might even consider deprecating them just like SciPy misc module by pointing to alternatives.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 3, 2019 at 6:38 PM Sebastian Berg <<a href="mailto:sebastian@sipsolutions.net">sebastian@sipsolutions.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Tue, 2019-09-03 at 08:56 -0400, Warren Weckesser wrote:<br>
> Github issue 2880 ("Get financial functions out of main namespace", <br>
<br>
Very briefly, I am absolutely in favor of this.<br>
<br>
Keeping the functions in numpy seems more of a liability than help<br>
anyone. And this push is more likely to help users by spurring<br>
development on a good replacement, than a practically unmaintained<br>
corner of NumPy that may seem like it solves a problem, but probably<br>
does so very poorly.<br>
<br>
Moving them into a separate pip installable package seems like the best<br>
way forward until a better replacement, to which we can point users,<br>
comes up.<br>
<br>
- Sebastian<br>
<br>
<br>
> <a href="https://github.com/numpy/numpy/issues/2880" rel="noreferrer" target="_blank">https://github.com/numpy/numpy/issues/2880</a>) has been open since 2013.<br>
> In a recent community meeting, it was suggested that we create a NEP<br>
> to propose the removal of the financial functions from NumPy.  I have<br>
> submitted "NEP 32:  Remove the financial functions from NumPy" in a<br>
> pull request at <a href="https://github.com/numpy/numpy/pull/14399" rel="noreferrer" target="_blank">https://github.com/numpy/numpy/pull/14399</a>.  A copy of<br>
> the latest version of the NEP is below.<br>
> <br>
> According to the NEP process document, "Once the PR is in place, the<br>
> NEP should be announced on the mailing list for discussion (comments<br>
> on the PR itself should be restricted to minor editorial and<br>
> technical fixes)."  This email is the announcement for NEP 32.<br>
> <br>
> The NEP includes a brief summary of the history of the financial<br>
> functions, and has links to several relevant mailing list threads,<br>
> dating back to when the functions were added to NumPy in 2008.  I<br>
> recommend reviewing those threads before commenting here.<br>
> <br>
> Warren<br>
> <br>
> -----<br>
> <br>
> ==================================================<br>
> NEP 32 — Remove the financial functions from NumPy<br>
> ==================================================<br>
> <br>
> :Author: Warren Weckesser <<a href="mailto:warren.weckesser@gmail.com" target="_blank">warren.weckesser@gmail.com</a>><br>
> :Status: Draft<br>
> :Type: Standards Track<br>
> :Created: 2019-08-30<br>
> <br>
> <br>
> Abstract<br>
> --------<br>
> <br>
> We propose deprecating and ultimately removing the financial<br>
> functions [1]_<br>
> from NumPy.  The functions will be moved to an independent<br>
> repository,<br>
> and provided to the community as a separate package with the name<br>
> ``numpy_financial``.<br>
> <br>
> <br>
> Motivation and scope<br>
> --------------------<br>
> <br>
> The NumPy financial functions [1]_ are the 10 functions ``fv``,<br>
> ``ipmt``,<br>
> ``irr``, ``mirr``, ``nper``, ``npv``, ``pmt``, ``ppmt``, ``pv`` and<br>
> ``rate``.<br>
> The functions provide elementary financial calculations such as<br>
> future value,<br>
> net present value, etc. These functions were added to NumPy in 2008<br>
> [2]_.<br>
> <br>
> In May, 2009, a request by Joe Harrington to add a function called<br>
> ``xirr`` to<br>
> the financial functions triggered a long thread about these functions<br>
> [3]_.<br>
> One important point that came up in that thread is that a "real"<br>
> financial<br>
> library must be able to handle real dates.  The NumPy financial<br>
> functions do<br>
> not work with actual dates or calendars.  The preference for a more<br>
> capable<br>
> library independent of NumPy was expressed several times in that<br>
> thread.<br>
> <br>
> In June, 2009, D. L. Goldsmith expressed concerns about the<br>
> correctness of the<br>
> implementations of some of the financial functions [4]_.  It was<br>
> suggested then<br>
> to move the financial functions out of NumPy to an independent<br>
> package.<br>
> <br>
> In a GitHub issue in 2013 [5]_, Nathaniel Smith suggested moving the<br>
> financial<br>
> functions from the top-level namespace to ``numpy.financial``.  He<br>
> also<br>
> suggested giving the functions better names.  Responses at that time<br>
> included<br>
> the suggestion to deprecate them and move them from NumPy to a<br>
> separate<br>
> package.  This issue is still open.<br>
> <br>
> Later in 2013 [6]_, it was suggested on the mailing list that these<br>
> functions<br>
> be removed from NumPy.<br>
> <br>
> The arguments for the removal of these functions from NumPy:<br>
> <br>
> * They are too specialized for NumPy.<br>
> * They are not actually useful for "real world" financial<br>
> calculations, because<br>
>   they do not handle real dates and calendars.<br>
> * The definition of "correctness" for some of these functions seems<br>
> to be a<br>
>   matter of convention, and the current NumPy developers do not have<br>
> the<br>
>   background to judge their correctness.<br>
> * There has been little interest among past and present NumPy<br>
> developers<br>
>   in maintaining these functions.<br>
> <br>
> The main arguments for keeping the functions in NumPy are:<br>
> <br>
> * Removing these functions will be disruptive for some users. <br>
> Current users<br>
>   will have to add the new ``numpy_financial`` package to their<br>
> dependencies,<br>
>   and then modify their code to use the new package.<br>
> * The functions provided, while not "industrial strength", are<br>
> apparently<br>
>   similar to functions provided by spreadsheets and some<br>
> calculators.  Having<br>
>   them available in NumPy makes it easier for some developers to<br>
> migrate their<br>
>   software to Python and NumPy.<br>
> <br>
> It is clear from comments in the mailing list discussions and in the<br>
> GitHub<br>
> issues that many current NumPy developers believe the benefits of<br>
> removing<br>
> the functions outweigh the costs.  For example, from [5]_::<br>
> <br>
>     The financial functions should probably be part of a separate<br>
> package<br>
>     -- Charles Harris<br>
> <br>
>     If there's a better package we can point people to we could just<br>
> deprecate<br>
>     them and then remove them entirely... I'd be fine with that<br>
> too...<br>
>     -- Nathaniel Smith<br>
> <br>
>     +1 to deprecate them. If no other package exists, it can be<br>
> created if<br>
>     someone feels the need for that.<br>
>     -- Ralf Gommers<br>
> <br>
>     I feel pretty strongly that we should deprecate these. If nobody<br>
> on numpy’s<br>
>     core team is interested in maintaining them, then it is purely a<br>
> drag on<br>
>     development for NumPy.<br>
>     -- Stephan Hoyer<br>
> <br>
> And from the 2013 mailing list discussion, about removing the<br>
> functions from<br>
> NumPy::<br>
> <br>
>     I am +1 as well, I don't think they should have been included in<br>
> the first<br>
>     place.<br>
>     -- David Cournapeau<br>
> <br>
> But not everyone was in favor of removal::<br>
> <br>
>     The fin routines are tiny and don't require much maintenance once<br>
>     written.  If we made an effort (putting up pages with examples of<br>
> common<br>
>     financial calculations and collecting those under a topical web<br>
> page,<br>
>     then linking to that page from various places and talking it up),<br>
> I<br>
>     would think they could attract users looking for a free way to<br>
> play with<br>
>     financial scenarios.  [...]<br>
>     So, I would say we keep them.  If ours are not the best, we<br>
> should bring<br>
>     them up to snuff.<br>
>     -- Joe Harrington<br>
> <br>
> For an idea of the maintenance burden of the financial functions, one<br>
> can<br>
> look for all the GitHub issues [7]_ and pull requests [8]_ that have<br>
> the tag<br>
> ``component: numpy.lib.financial``.<br>
> <br>
> One method for measuring the effect of removing these functions is to<br>
> find<br>
> all the packages on GitHub that use them.  Such a search can be<br>
> performed<br>
> with the ``python-api-inspect`` service [9]_.  A search for all uses<br>
> of the<br>
> NumPy financial functions finds just eight repositories.  (See the<br>
> comments<br>
> in [5]_ for the actual SQL query.)<br>
> <br>
> <br>
> Implementation<br>
> --------------<br>
> <br>
> * Create a new Python package, ``numpy_financial``, to be maintained<br>
> in the<br>
>   top-level NumPy github organization.  This repository will contain<br>
> the<br>
>   definitions and unit tests for the financial functions.  The<br>
> package will<br>
>   be added to PyPI so it can be installed with ``pip``.<br>
> * Deprecate the financial functions in the ``numpy`` namespace,<br>
> beginning in<br>
>   NumPy version 1.18. Remove the financial functions from NumPy<br>
> version 1.20.<br>
> <br>
> <br>
> Backward compatibility<br>
> ----------------------<br>
> <br>
> The removal of these functions breaks backward compatibility, as<br>
> explained<br>
> earlier.  The effects are mitigated by providing the<br>
> ``numpy_financial``<br>
> library.<br>
> <br>
> <br>
> Alternatives<br>
> ------------<br>
> <br>
> The following alternatives were mentioned in [5]_:<br>
> <br>
> * *Maintain the functions as they are (i.e. do nothing).*<br>
>   A review of the history makes clear that this is not the preference<br>
> of many<br>
>   NumPy developers.  A recurring comment is that the functions simply<br>
> do not<br>
>   belong in NumPy.  When that sentiment is combined with the history<br>
> of bug<br>
>   reports and the ongoing questions about the correctness of the<br>
> functions, the<br>
>   conclusion is that the cleanest solution is deprecation and<br>
> removal.<br>
> * *Move the functions from the ``numpy`` namespace to<br>
> ``numpy.financial``.*<br>
>   This was the initial suggestion in [5]_.  Such a change does not<br>
> address the<br>
>   maintenance issues, and doesn't change the misfit that many<br>
> developers see<br>
>   between these functions and NumPy.  It causes disruption for the<br>
> current<br>
>   users of these functions without addressing what many developers<br>
> see as the<br>
>   fundamental problem.<br>
> <br>
> <br>
> Discussion<br>
> ----------<br>
> <br>
> Links to past mailing list discussions, and to relevant GitHub issues<br>
> and pull<br>
> requests, have already been given.<br>
> <br>
> <br>
> References and footnotes<br>
> ------------------------<br>
> <br>
> .. [1] Financial functions,<br>
>    <a href="https://numpy.org/doc/1.17/reference/routines.financial.html" rel="noreferrer" target="_blank">https://numpy.org/doc/1.17/reference/routines.financial.html</a><br>
> <br>
> .. [2] Numpy-discussion mailing list, "Simple financial functions for<br>
> NumPy",<br>
>    <br>
> <a href="https://mail.python.org/pipermail/numpy-discussion/2008-April/032353.html" rel="noreferrer" target="_blank">https://mail.python.org/pipermail/numpy-discussion/2008-April/032353.html</a><br>
> <br>
> .. [3] Numpy-discussion mailing list, "add xirr to numpy financial<br>
> functions?",<br>
>    <br>
> <a href="https://mail.python.org/pipermail/numpy-discussion/2009-May/042645.html" rel="noreferrer" target="_blank">https://mail.python.org/pipermail/numpy-discussion/2009-May/042645.html</a><br>
> <br>
> .. [4] Numpy-discussion mailing list, "Definitions of pv, fv, nper,<br>
> pmt, and rate",<br>
>    <br>
> <a href="https://mail.python.org/pipermail/numpy-discussion/2009-June/043188.html" rel="noreferrer" target="_blank">https://mail.python.org/pipermail/numpy-discussion/2009-June/043188.html</a><br>
> <br>
> .. [5] Get financial functions out of main namespace,<br>
>    <a href="https://github.com/numpy/numpy/issues/2880" rel="noreferrer" target="_blank">https://github.com/numpy/numpy/issues/2880</a><br>
> <br>
> .. [6] Numpy-discussion mailing list, "Deprecation of financial<br>
> routines",<br>
>    <br>
> <a href="https://mail.python.org/pipermail/numpy-discussion/2013-August/067409.html" rel="noreferrer" target="_blank">https://mail.python.org/pipermail/numpy-discussion/2013-August/067409.html</a><br>
> <br>
> .. [7] ``component: numpy.lib.financial`` issues,<br>
>    <br>
> <a href="https://github.com/numpy/numpy/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22component%3A+numpy.lib.financial%22+" rel="noreferrer" target="_blank">https://github.com/numpy/numpy/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22component%3A+numpy.lib.financial%22+</a><br>
> <br>
> .. [8] ``component: numpy.lib.financial`` pull request,<br>
>    <br>
> <a href="https://github.com/numpy/numpy/pulls?utf8=%E2%9C%93&q=is%3Apr+label%3A%22component%3A+numpy.lib.financial%22+" rel="noreferrer" target="_blank">https://github.com/numpy/numpy/pulls?utf8=%E2%9C%93&q=is%3Apr+label%3A%22component%3A+numpy.lib.financial%22+</a><br>
> <br>
> .. [9] Quansight-Labs/python-api-inspect,<br>
>    <a href="https://github.com/Quansight-Labs/python-api-inspect/" rel="noreferrer" target="_blank">https://github.com/Quansight-Labs/python-api-inspect/</a><br>
> <br>
> <br>
> Copyright<br>
> ---------<br>
> <br>
> This document has been placed in the public domain.<br>
> <br>
> _______________________________________________<br>
> NumPy-Discussion mailing list<br>
> <a href="mailto:NumPy-Discussion@python.org" target="_blank">NumPy-Discussion@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/numpy-discussion</a><br>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@python.org" target="_blank">NumPy-Discussion@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/numpy-discussion</a><br>
</blockquote></div>