diff options
| author | Charles Harris <charlesr.harris@gmail.com> | 2021-09-13 17:21:51 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-13 17:21:51 -0600 |
| commit | e4f85b08c252b576f3c589cc1202f040c22d64f2 (patch) | |
| tree | b27726456eca5573642a34724f25fa60b00cecdf /numpy/lib/nanfunctions.py | |
| parent | 3455bc3bb29a29ee827a56834f0403ab002573ad (diff) | |
| parent | eb6ae9b45f7aadbf64c581b0db3a7ca74ac8ff0a (diff) | |
| download | numpy-e4f85b08c252b576f3c589cc1202f040c22d64f2.tar.gz | |
Merge pull request #19863 from BvB93/nanquantile
BUG: Fix `nanpercentile` ignoring the dtype of all-nan arrays
Diffstat (limited to 'numpy/lib/nanfunctions.py')
| -rw-r--r-- | numpy/lib/nanfunctions.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/numpy/lib/nanfunctions.py b/numpy/lib/nanfunctions.py index 766bf3c82..658ec5255 100644 --- a/numpy/lib/nanfunctions.py +++ b/numpy/lib/nanfunctions.py @@ -1421,7 +1421,8 @@ def _nanquantile_1d(arr1d, q, overwrite_input=False, interpolation='linear'): arr1d, overwrite_input = _remove_nan_1d(arr1d, overwrite_input=overwrite_input) if arr1d.size == 0: - return np.full(q.shape, np.nan)[()] # convert to scalar + # convert to scalar + return np.full(q.shape, np.nan, dtype=arr1d.dtype)[()] return function_base._quantile_unchecked( arr1d, q, overwrite_input=overwrite_input, interpolation=interpolation) |
