| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
This PR adds additional tests for quantiles:
1. Identification equation $E[V(q, Y)] = 0$
2. Adding a constant $c > 0$: $q(c + Y) = c + q(Y)$
3. Multiplying by a constant $c > 0$: $q(c \cdot Y) = c \cdot q(y)$
4. Multiplying by $-1$: $q_{\alpha}(-Y) = -q_{1-\alpha}(Y)$
(Note by seberg as reviewer: These tests are fairly complex, but may be useful for future development. But if they seem too complicated, they are probably not really vital and could be shortened or removed.)
|
| |
|
| |
|
| |
|
| |
|
|\
| |
| | |
ENH: Enabled the use of numpy.vectorize as a decorator
|
| |
| |
| |
| | |
This reverses commit 7a2ded1522305
|
| | |
|
| |
| |
| |
| |
| | |
This test makes sure a function's docstring is properly preserved
after calling the vectorize decorator.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Most of this code comes from PR-9593, but with the default value for pyfunc
being numpy._NoValue instead of None, no override of __new__, and no effort
to make subclassing possible.
Co-Authored-By: Michael Lamparski <diagonaldevice@gmail.com>
|
| | |
|
| |
| |
| |
| | |
[skip cirrus]
|
| | |
|
|/
|
|
|
| |
This change is staged for NumPy 2.0, I assume we could get away with
it otherwise, but it is a nice example and probably not pressing.
|
|
|
|
| |
There should be more tests for this, but this now passes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since percentile is more or less identical to quantile, I also made it
throw an error if it receives a complex input. I also made nanquantile
and nanpercentile throw errors as well.
* Made the changes recommended by seberg
* Fixed a test for PR 22703
* Fixed tests for quantile
* Shortened some more lines
* Fixup more lines
Co-authored-by: Sebastian Berg <sebastianb@nvidia.com>
|
|
|
|
|
|
| |
`numpy.percentile()`, and `numpy.quantile()`.
Closes #22714, #22544.
|
| |
|
|
|
|
|
|
|
|
| |
In some cases, the replacement is clearly not what is intended,
in those (where setup was called explicitly), I mostly renamed
`setup` to `_setup`.
The `test_ccompile_opt` is a bit confusing, so left it right now
(this will probably fail)
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
The lerp test compared the output of the original and the symmetric
functions by using basic assertion. Double precision errors could
accumulate in a way that the 2 outputs mismatch by epsilon.
For more information on the precision issue, see #22073
Fix: use assert_allclose instead for float comparison.
|
|
|
|
| |
This reverts commit 8cd6f4ca00b6e0da3833fc267d50067b2ddbc069.
|
|
|
|
|
|
| |
This enables any ufunc numpy operations that are called on a
MaskedArray to use the masked version of that function automatically
without needing to resort to np.ma.func() calls.
|
| |
|
|
|
|
|
|
| |
This enables any ufunc numpy operations that are called on a
MaskedArray to use the masked version of that function automatically
without needing to resort to np.ma.func() calls.
|
|
|
|
|
|
|
|
| |
Non integer array-likes were not correctly rejected when a new
fast-path was added to `np.delete` in gh-16895.
This includes the _explicitly_ added `dtype=object` which should
not be allowed since it is not allowed in normal indexing either.
Closes gh-21840
|
|
|
|
|
|
|
|
|
| |
(#21851)
The keepdims flag needs to be applied during the calculation of the sum of
the weights in np.average and np.ma.average. Not passing it causes weights
to broadcast incorrectly.
Fixes #21850
|
| |
|
|
|
|
|
|
| |
Promotion in percentile will now more aggressively preserve the
input dtype for floating point types (rather than upgrading the
type to at least float64).
|
| |
|
| |
|
|
|
|
|
| |
Also, the closest-observation did not correctly support multiple
quantiles calculated at the same time (broadcasting error).
|
| |
|
| |
|
|
|
|
|
| |
On some platforms float128 and complex256 do not exist.
Using (c)longdouble aliases should work on all platforms.
|
| |
|
| |
|
|
|
|
| |
Also added unit test for it.
|
|
|
|
|
| |
- some changes were unrelated to the PR and have been reverted, including, renaming and moving the logic around.
- Also renamed _quantile_ureduce_func to its original name
|
|
|
|
|
|
|
|
|
|
| |
- Added the missing linear interpolation methods.
- Updated the existing unit tests.
- Added pytest.mark.xfail for boolean arrays
See
- https://github.com/numpy/numpy/pull/19857#issuecomment-919258693
- https://github.com/numpy/numpy/issues/19154
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When `insert` is given a single out-of-bounds index in a
list, e.g.
np.insert([0, 1, 2], [99], [3, 4]) # 99 is out of bounds
a TypeError was being raised because of a bug in the formatting
of the message.
Before this change, the error is
TypeError: %i format: a number is required, not list
After, we get the expected
IndexError: index [99] is out of bounds for axis 0 with size 3
|
| |
|
|
|
|
| |
precision float dtypes
|
|
|
|
|
|
|
|
| |
Currently, np.median is almost completely safe for subclasses, except
if the result is NaN. In that case, it assumes the result is a scalar
and substitutes a NaN with the right dtype. This PR fixes that, since
subclasses like astropy's Quantity generally use array scalars to
preserve subclass information such as the unit.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
As is, this is true for the ufunc case, but not for the gufunc case,
even if the underlying function does produce a subclass. Given the
care taken to ensure inputs are kept as subclasses, this is almost
certainly an oversight, which is here corrected.
|