8000 numpy irr should check whether the masked solution is empty · Issue #6744 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
numpy irr should check whether the masked solution is empty #6744
Closed
@jburroni

Description

@jburroni

In the current implementation, when no solution is returned by roots, the function return np.nan. But if no real solution is returned, the function fails with an exception:

ValueError: attempt to get argmin of an empty sequence

The proposed fix is to add the following to https://github.com/numpy/numpy/blob/master/numpy/lib/financial.py#L654

if res.size == 0 or res[mask].size == 0:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0