diff options
author | Zijie (ZJ) Poh <8103276+zjpoh@users.noreply.github.com> | 2019-10-15 12:13:22 -0700 |
---|---|---|
committer | Sebastian Berg <sebastian@sipsolutions.net> | 2019-10-15 12:13:22 -0700 |
commit | 83da5faca3a313c5d37226b86fa781956f8d162b (patch) | |
tree | effa51267edd3e7640d83f6006d6189e7092a1b4 /numpy/lib | |
parent | 9b0377f62fc20bbc289e508a33f35734b205c404 (diff) | |
download | numpy-83da5faca3a313c5d37226b86fa781956f8d162b.tar.gz |
DOC: Add to doc that interp cannot contain NaN (#14598)
Address gh-13919 by adding to documentation that xp cannot contain NaN because its input is required to be sorted.
Closes gh-13919
Diffstat (limited to 'numpy/lib')
-rw-r--r-- | numpy/lib/function_base.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 46950bc95..c39c2eea1 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -1314,9 +1314,13 @@ def interp(x, xp, fp, left=None, right=None, period=None): Notes ----- - Does not check that the x-coordinate sequence `xp` is increasing. - If `xp` is not increasing, the results are nonsense. - A simple check for increasing is:: + The x-coordinate sequence is expected to be increasing, but this is not + explicitly enforced. However, if the sequence `xp` is non-increasing, + interpolation results are meaningless. + + Note that, since NaN is unsortable, `xp` also cannot contain NaNs. + + A simple check for `xp` being strictly increasing is:: np.all(np.diff(xp) > 0) |