summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/lib/function_base.py2
-rw-r--r--numpy/lib/tests/test_function_base.py10
2 files changed, 11 insertions, 1 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index 12320ae47..47b5133be 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -3870,7 +3870,7 @@ def _quantile_ureduce_func(a, q, axis=None, out=None, overwrite_input=False,
"'midpoint', or 'nearest'")
n = np.array(False, dtype=bool) # check for nan's flag
- if indices.dtype == intp: # take the points along axis
+ if np.issubdtype(indices.dtype, np.integer): # take the points along axis
# Check if the array contains any nan's
if np.issubdtype(a.dtype, np.inexact):
indices = concatenate((indices, [-1]))
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py
index 7953de15d..83fbd8bcc 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -2967,6 +2967,16 @@ class TestQuantile:
assert_equal(np.quantile(x, 1), 3.5)
assert_equal(np.quantile(x, 0.5), 1.75)
+ def test_correct_quantile_value(self):
+ a = np.array([True])
+ tf_quant = np.quantile(True, False)
+ assert_equal(tf_quant, a[0])
+ assert_equal(type(tf_quant), a.dtype)
+ a = np.array([False, True, True])
+ quant_res = np.quantile(a, a)
+ assert_array_equal(quant_res, a)
+ assert_equal(a.dtype, quant_res.dtype)
+
def test_fraction(self):
# fractional input, integral quantile
x = [Fraction(i, 2) for i in range(8)]