summaryrefslogtreecommitdiff
path: root/numpy/core/fromnumeric.py
diff options
context:
space:
mode:
authorTyler Reddy <tyler.je.reddy@gmail.com>2019-03-04 19:27:47 -0800
committerTyler Reddy <tyler.je.reddy@gmail.com>2019-05-14 13:52:36 -0700
commit6492f632a92439c82c74efa6753e10ce9360c6ba (patch)
treea6fdbc0753e2315a392def7142d7539d59c50eb6 /numpy/core/fromnumeric.py
parentdfe7b9db2350505903ba19867bf27dabda2bff71 (diff)
downloadnumpy-6492f632a92439c82c74efa6753e10ce9360c6ba.tar.gz
MAINT: address reviewer comments
* Unit test for object clip issue * parametrized test_simple_int32_inout() to additionally handle scenario where "unsafe" casting is explicitly passed through, as requested by reviewer * add a requested comment related to possibility of future nan check optimization for `@name@_clip` * add a unit test to cover the case where np.clip() is called with None for both max and min * add a unit test for the case where out is None and casting is specified as an invalid value, to flush through code path in TestClip.fastclip * add unit test + doc update for expected behavior when amin > amax * add unit test + patch for bug in npy_ObjectClip; its operations and operands were wrong; the unit test case is based on a scenario probed by the hypothesis library * add unit test for error in timedelta64 MAX function for clip handling * add unit test for a pathological case where np.ones(10) is clipped with amin=1, amax=0
Diffstat (limited to 'numpy/core/fromnumeric.py')
-rw-r--r--numpy/core/fromnumeric.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py
index 814ade64e..58da8a54b 100644
--- a/numpy/core/fromnumeric.py
+++ b/numpy/core/fromnumeric.py
@@ -1975,6 +1975,9 @@ def clip(a, a_min, a_max, out=None, **kwargs):
is specified, values smaller than 0 become 0, and values larger
than 1 become 1.
+ Equivalent to but faster than ``np.maximum(a_min, np.minimum(a, a_max))``.
+ No check is performed to ensure ``a_min < a_max``.
+
Parameters
----------
a : array_like