| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
The tests randomize the nan pattern and thus can run into these
(additional) warnings, so ignore them.
(Could also fix the random seed, but this should do)
Closes gh-22835
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Co-Authored-By: Charles Harris <charlesr.harris@gmail.com>
|
|
|
|
| |
Parametrize w.r.t. the axis, array dimensionality and dtype
|
| |
|
|
|
|
|
|
| |
This makes the test more precise, and I ran into having to broaden
the xfails otherwise, because right now reduce-likes incorrectly
faile to give floating point warnings (and I was fixing that).
|
| |
|
|
|
|
| |
types
|
|
|
|
| |
Test multiple dtypes in the `test_allnans` + a minor refactor
|
|
|
|
| |
This is a follow up to d1d9dd58e2de5f3b69c02b104e1daaeec1f38d9f, as more regressions in this style have been introduced since that commit.
|
|
|
|
|
|
|
| |
Inheriting from object was necessary for Python 2 compatibility to use
new-style classes. In Python 3, this is unnecessary as there are no
old-style classes.
Dropping the object is more idiomatic Python.
|
|
|
|
|
| |
As numpy is Python 3 only, these import statements are now unnecessary
and don't alter runtime behavior.
|
| |
|
|
|
|
|
|
|
|
|
| |
* add _nan_mask function and
associated unit tests; this function
is to be used to simplify reduction
operations involving np.nan elements
by using a mask with a ``where``
argument
|
|\
| |
| | |
Move remaining Matrix tests to matrixlib
|
| | |
|
|/
|
|
|
|
|
|
|
| |
User- and non-user-facing typos.
Some source typos fixes as well.
Found via `codespell`.
|
| |
|
|
|
|
|
| |
That function is nose specific and has not worked since `__init__` files
were added to the tests directories.
|
| |
|
|
|
|
| |
Fixes gh-8974 and gh-9008
|
|
|
|
| |
This fixes an omission where duplicate axes would only be detected when positive
|
|
|
|
|
|
|
| |
the masked nans which are equivalent to valid infs must be replaced
with infs earlier otherwise the inf is lost in the masked sum of the low
and high part.
Closes gh-8487
|
|\
| |
| | |
BUG: handle unmasked NaN in ma.median like normal median
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This requires to base masked median on sort(endwith=False) as we need to
distinguish Inf and NaN.
Using Inf as filler element of the sort does not work as then the mask is not
guaranteed to be at the end.
Closes gh-8340
Also fixed 1d ma.median not handling np.inf correctly, the nd variant
was ok.
|
|/
|
|
| |
Closes gh-8220
|
| |
|
| |
|
|
|
|
|
|
| |
Comment mentions a speedup, but it seems unsure why it should
be there. Instead use an error state in divide_by_count.
Some extra complex warnings had to be ignored (but those seemed correct)
|
|
|
|
|
|
|
|
| |
This PR adds an implementation of `nancumsum` and `nancumprod`.
The actual function is a two-liner adapted from `nansum`.
Its structure is adapted from PR: https://github.com/numpy/numpy/pull/5418/
|
|
|
|
|
|
|
|
|
| |
nanpercentile was conforming to dimension convention of percentile incorrectly.
percentile outputs results for the different percentiles along the first
dimension of the output. nanpercentile was moving the reduction axis to the
front using swapaxes, which would move the first axis out of place if there
were more than two in the array. Added a test with more than two axes to
demonstrate and used rollaxis instead of swapaxes to do the interhange.
|
|\
| |
| | |
BUG: Handle multiple percentiles for all-nan slices in nanpercentile
|
| |
| |
| |
| |
| |
| |
| |
| | |
Fix bug where nanpercentile would crash with an all-nan slices when
given multiple percentiles. Also corrects behavior where array sizes
different from numpy.percentile would be returned with keepdims enabled.
Fix #5760
|
|/ |
|
|
|
|
|
| |
Discovered while cleaning up uses of the silly aliases like
'np.object'.
|
|
|
|
|
|
|
|
|
|
|
| |
This PR adds an implementation of `nanprod`.
The actual function is a two-liner adapted from `nansum`. Most of this PR
consists of documentation and tests (for which I took the opportunity to do
some consolidation).
A method with the same functionality exists in pandas, and I was surprised to
discover that it's not in numpy.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are two issues:
A masked divide of an infinite value is a masked value which means one
can't use np.ma.mean to compute the median as infinity division is well
defined.
This behaviour seems wrong to me but it also looks intentional so
changing it is not appropriate for a bugfix release.
The second issue is that the ordering of the sorted masked array is
undefined for equal values, the sorting considers infinity the largest
floating point value which is not correct in respect to sorting where
nan is considered larger. This is fixed by changing the
minimum_fill_value to nan for float data in the masked sorts.
Closes gh-5138
|
|
|
|
|
|
|
| |
The possibly controversial part of this is making the nested array
value lists PEP8 compliant, as there is something to be said aligning
the values for clarity. In the end, it seemed like the easiest thing
to do was to make them PEP8 compliant. The eye can get used to that.
|
| |
|
|
|
|
| |
Also some PEP-8 fixes and test improvements
|
|
|
|
|
|
| |
Implemented a nanpercentile and associated tests
as an extension of np.percentile to complement the
other nanfunctions.
|
|
|
|
|
|
|
|
|
|
| |
Implemented a nanmedian and associated tests as an
extension of np.median to complement the other
nanfunctions
Added negative values to the unit tests
Cleaned up documentation of nanmedian
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a warning is ignored (or raised once) in python, the warnings
module will tag on a `__warningregistry__` dictionary to be able
to filter these warnings in the future. This is tagged on to the
current context, causing leakage to later calls (this is a bit
more complex, since where the registry ends up depends on the
layers between the original caller and warner).
In short, tests should typically not use ignore but catch the
warnings to avoid changing the user experience (or errors
on duplicate test runs).
Fixes an error on duplicate test runs (does not remove all
"ignores" which may change behaviour outside tests).
Closes gh-4340
|