summaryrefslogtreecommitdiff
path: root/numpy/lib/nanfunctions.py
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge pull request #9220 from eric-wieser/simplify-nanfuncsCharles Harris2017-06-221-43/+53
|\ | | | | MAINT: Factor out code duplicated by nanmedian and nanpercentile
| * MAINT: Factor out code duplicated by nanmedian and nanpercentileEric Wieser2017-06-211-43/+53
| |
* | DOC: BLD: fix lots of Sphinx warnings/errors.Ralf Gommers2017-06-101-1/+1
|/
* MAINT: Don't internally use the one-argument whereEric Wieser2017-06-031-2/+2
| | | | nonzero is a clearer spelling
* MAINT: Combine similar branchesEric Wieser2017-06-031-4/+1
|
* BUG: Fix incorrect behavior of nanfunctions on object arraysEric Wieser2017-04-291-8/+16
| | | | Fixes gh-8974 and gh-9008
* MAINT: Remove weird create-a-copy danceEric Wieser2017-04-271-6/+2
|
* DOC: Fix typos in percentile (#8900)Baurzhan Muftakhidinov2017-04-061-2/+2
|
* ENH: retune apply_along_axis nanmedian cutoffJulian Taylor2016-12-171-1/+2
| | | | | Old value was erroneously obtained on a sorted array which is a best case for the median of 3 pivoted introsort.
* Merge pull request #8364 from juliantaylor/masked-median-nanCharles Harris2016-12-121-1/+1
|\ | | | | BUG: handle unmasked NaN in ma.median like normal median
| * ENH: update the small nanmedian thresholdJulian Taylor2016-12-121-1/+1
| | | | | | | | | | | | | | | | The apply_along_axis path is significantly more expensive than currently accounted for in the check. Increase the minimum axis size from 400 to 1000 elements. Either apply_along_axis got more expensive over time or the original benchmarking was flawed.
* | BUG: fix nanpercentile not returning scalar with axis argumentJulian Taylor2016-12-111-1/+1
|/ | | | Closes gh-8220
* DOC: change version references from x.y to x.y.zPierre de Buyl2016-09-071-1/+1
|
* DOC: change Numpy to NumPy in dosctrings and commentsPierre de Buyl2016-09-061-3/+3
| | | | The strings in error messages were left untouched
* ENH: Add stacklevel to all (or almost all) our function callsSebastian Berg2016-09-021-9/+9
|
* ENH: Remove warning ignoring from nanfuncsSebastian Berg2016-09-021-39/+33
| | | | | | 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)
* ENH: adds np.nancumsum and np.nancumprodPhillip J. Wolfram2016-03-241-15/+139
| | | | | | | | 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/
* DOC: Removed residual merge markup from previous commitMad Physicist2016-02-131-6/+0
|
* BUG: many functions silently drop `keepdims` kwargThomas A Caswell2016-02-071-39/+106
| | | | | | | | | | | | | | | | | | | | change test from `type(a) is not mu.ndarray` to `not isinstance(a, mu.ndarray)` Because every sub-class of ndarray is not guaranteed to implement `keepdims` as a kwarg, when wrapping these methods care must be taken. The previous behavior was to silently eat the kwarg when dealing with a sub-class of ndarray. Now, if `keepdims=np._NoValue` (the new default) it is not passed through to the underlying function call (so the default value of `keepdims` is now controlled by the sub-class). If `keepdims` is not `np._NoValue` then it is passed through and will raise an exception if the sub-class does not support the kwarg. A special case in nanvar was required to deal with `matrix` that previously relied on `fromnumeric` silently dropping `keepdims`.
* Merge pull request #7181 from madphysicist/doc-typosCharles Harris2016-02-071-78/+81
|\ | | | | DOC: Updated minor typos in function_base.py and test_function_base.py
| * DOC: Updated minor typos in function_base.py and test_function_base.pyJoseph Fox-Rabinovitz2016-02-051-78/+81
| |
* | BUG: Fixed previous attempt to fix dimension mismatch in nanpercentileJoseph Fox-Rabinovitz2016-02-051-1/+2
|/ | | | | | | | | 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: Fix nanpercentile crash on all-nan slicesDavid Freese2016-01-121-2/+9
| | | | | | | | 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
* ENH: add np.nanprodStephan Hoyer2015-01-051-1/+76
| | | | | | | | | | | 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.
* Merge pull request #4929 from juliantaylor/charris-pep8-numpy-libCharles Harris2014-07-311-2/+0
|\ | | | | Charris pep8 numpy lib
| * MAINT: Fixes for problems in numpy/lib revealed by pyflakes.Charles Harris2014-07-311-2/+0
| | | | | | | | | | | | Some of those problems look like potential coding errors. In those cases a Fixme comment was made and the offending code, usually an unused variable, was commented out.
* | Merge pull request #4671 from charris/prepare-1.10-develCharles Harris2014-07-061-1/+5
|\ \ | |/ |/| MAINT: start 1.10-devel.
| * MAINT: Change default inplace, ufunc(...,out=x) casting to same_kind.Charles Harris2014-05-061-1/+5
| | | | | | | | | | | | There has been a warning of this change since numpy 1.7. numpy 1.10 is a good time to do it. The nanvar function needed a fix after the change, and the tests and documentation are updated.
* | ENH: use masked median for small multidimensional nanmediansJulian Taylor2014-06-021-1/+19
| |
* | BUG: nanpercentile/nanmedian 0-d with output given.Sebastian Berg2014-05-281-25/+24
| | | | | | | | Also some PEP-8 fixes and test improvements
* | ENH: added functionality nanpercentile to numpyDavid Freese2014-05-221-1/+173
|/ | | | | | Implemented a nanpercentile and associated tests as an extension of np.percentile to complement the other nanfunctions.
* ENH: added functionality nanmedian to numpyDavid Freese2014-05-021-2/+144
| | | | | | | | | | 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
* BUG: incorrect argument order to _copyto in in np.nanmax, np.nanminMarten van Kerkwijk2014-04-201-2/+2
|
* BUG: Refactor nanfunctions to behave as agreed on for 1.9.Charles Harris2013-10-041-144/+172
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Deal with subclasses of ndarray, like pandas.Series and matrix. Subclasses may not define the new keyword keepdims or deal gracefully with ufuncs in all their forms. This is solved by throwing the problem onto the np.sum, np.any, etc. functions that have ugly hacks to deal with the problem. Settle handling of all-nan slices. nanmax, nanmin -- Raise warning, return NaN for slice. nanargmax, nanargmin -- Raise ValueError. nansum -- Return 0 for slice. nanmean, nanvar, nanstd -- Raise warning, return NaN for slice. Make NaN functions work for scalar arguments. This may seem silly, but it removes a check for special cases. Update tests Deal with new all-nan handling. Test with matrix class as example of subclass without keepdims. Test with scalar arguments. Fix nanvar issue reported in #3860. Closes #3860 #3850
* DOC: Make documentation of nansum current with 1.9.Charles Harris2013-09-141-2/+2
| | | | | Simply state that Numpy versions < 1.9 returned nan instead of zero for the sum of empty slices.
* DEP: Make nansum return 0 for all-NaN or empty axis.Charles Harris2013-08-181-12/+1
| | | | | Make this happen and remove test parts dependent on numpy version < 1.9. Fixes test failures in numpy after 1.8 branch.
* DOC: Various fixes.Charles Harris2013-08-141-15/+14
| | | | | | Fix typos and clarify some explanations. Document the changes in the return values of nanargmin and nanargmax for all-NaN slices in the 1.8.0 release notes.
* MAINT: Refactor nanfunctions.Charles Harris2013-08-121-333/+468
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nanmax, nanmin -------------- Add out and keepdims keywords. nanargmin, nanargmax -------------------- A NanWarning is raised if an all NaN slice detected. For all such slices np.iingo(np.intp).min is returned as the index value. nansum ------ The keywords dtype, out, and keepdims are added. A FutureWarning is raised, as in the future the mean of an empty slice after NaN replacement will be 0 instead of the current NaN. nanmean, nanvar, nanstd ----------------------- For all, if the input array is of inexact type then the dtype and out parameters must be of inexact type if specified. That insures that NaNs can be returned when appropriate. The nanmean function detects empty slices after NaN replacement and raises a NanWarning. NaN is returned as the value for all such slices. The nanmean and nanstd functions detect degrees of freedom <= 0 after NaN replacement and raise a NanWarning. NaN is returned as the value for all such slices.
* MAINT: Separate nan functions into their own module.Charles Harris2013-08-121-0/+678
New files lib/nanfunctions.py and lib/tests/test_nanfunctions.py are added and both the previous and new nan functions and tests are moved into them. The existing nan functions moved from lib/function_base are: nansum, nanmin, nanmax, nanargmin, nanargmax The added nan functions moved from core/numeric are: nanmean, nanvar, nanstd