summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
Commit message (Collapse)AuthorAgeFilesLines
* DOC: Fixes for 18 broken links (#16472)bjnath2020-06-061-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * DOC: Fixes for 18 broken links This, with PR #16465, should fix nearly all the remaining broken links on the site. 4 or 5 others should be easy to fix and just need attention from someone more knowledgeable -- will open an issue. For release notes with dead links, I could usually find links on archive.org for roughly contemporary versions. * DOC: Update to "Fixes for 18 broken links #16472" * Obsolete links, previously commented out, now deleted: https://github.com/numpy/numpy/pull/16472#discussion_r433928958 * Semantic markup for reference to Python class: https://github.com/numpy/numpy/pull/16472#discussion_r433553928 * Missing :ref: in internal link: https://github.com/numpy/numpy/pull/16472#discussion_r433554484 Not included: Resolution on using external/internal doc link in .py: https://github.com/numpy/numpy/pull/16472#discussion_r433554824 * DOC: Add internal link for 'Fixes for 18 broken links' PR #16472 Making reference [1] an internal link in function_base.py => numpy.vectorize.html * DOC: Redirect 2 link fixes in PR #16472 * governance.rst link reverted * ununcs.rst `overridden` link goes where it was meant to per https://github.com/numpy/numpy/pull/16472#pullrequestreview-424666070
* MAINT: use zip instead of range in piecewiseEric Wieser2020-06-011-8/+6
| | | | Minor cleanup while looking at something else.
* DOC: make clearer that sinc is normalized by a factor piRalf Gommers2020-05-301-4/+11
| | | | Addresses gh-13457
* Merge pull request #16332 from ↵Matti Picus2020-05-221-0/+4
|\ | | | | | | | | LSchroefl/link_SciPy_multidimensional_interpolation DOC: link np.interp to SciPy's interpolation functions (closes #14154)
| * Update numpy/lib/function_base.pyLSchroefl2020-05-221-1/+1
| | | | | | Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
| * DOC: link np.interp to SciPy's multidimensional interpolation functions (#14154)skywalker2020-05-211-0/+4
| |
* | Merge pull request #16284 from eric-wieser/extract-lerpSebastian Berg2020-05-191-62/+58
|\ \ | | | | | | MAINT: Clean up the implementation of quantile
| * | MAINT: remove workaround for fixed issue Eric Wieser2020-05-191-2/+0
| | | | | | | | | take now correctly returns `out`, even on 0d arrays
| * | MAINT: Remove special cases for 0d arrays in quantileEric Wieser2020-05-181-62/+55
| | | | | | | | | | | | This also simplifies the axis handling logic, taking advantage of the fact we know `axis` is 0 for the rest of the function body
| * | MAINT: Extract a lerp helper function to make the algorithm of quantile clearerEric Wieser2020-05-181-4/+9
| |/ | | | | | | This does not affect the behavior in any way
* | Merge pull request #16156 from WarrenWeckesser/deprecate-dualSebastian Berg2020-05-191-1/+0
|\ \ | |/ |/| DEP: Deprecate `numpy.dual`.
| * DEP: Deprecate `numpy.dual`.Warren Weckesser2020-05-041-1/+0
| | | | | | | | | | | | Add a deprecation warning in the `numpy.dual` module, and remove the use of `numpy.dual` from the few places where it is used in the numpy code.
* | MAINT: Avoid moving axes around multiple timesEric Wieser2020-05-171-15/+5
| | | | | | | | It's easier to move the relevant axis to position 0 in `ap` first than it is to move it for every relevant object simultaneously.
* | MAINT: Remove a pointless ifEric Wieser2020-05-171-4/+1
| | | | | | | | The `add` ufunc is happy to handle `out=None` by itself
* | Merge pull request #16125 from WarrenWeckesser/vectorize-bugMatti Picus2020-05-061-7/+15
|\ \ | | | | | | BUG: lib: Fix a problem with vectorize with default parameters.
| * | BUG: lib: Fix a problem with vectorize with default parameters.Warren Weckesser2020-04-301-7/+15
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When `otypes` is given to `vectorize` and then the instance is called, it creates a ufunc by calling numpy.core.umath.frompyfunc. The number of arguments given to this ufunc is set to the number of arguments in the call of the vectorize instance. This ufunc is cached, so frompyfunc does not have to be called on the next call. The problem is that, if the function being wrapped has parameters with default values, the number of arguments passed to the vectorize instance can change, and when that happens, a new ufunc must be created by calling frompyfunc with the correct number of arguments. This commit changes the cache of the ufunc from a simple attribute that holds the most recent ufunc to a dictionary whose keys are the number of arguments in the call. The cache is only used when the vectorized function is called with only positional arguments and there are no excluded arguments. If keywords are used, the number of arguments is no longer sufficient to uniquely identify a previously created ufunc. Closes gh-16120.
* | DOC: Update np.copy docstring to include ragged case (#15928)Guilherme Leobas2020-05-051-0/+24
|/ | | | | | | | | We only do a shallow copy of arrays (mainly important for object arrays), so mention that in the documentation. Fixes #15923 Co-Authored-By: Eric Wieser <wieser.eric@gmail.com> Co-Authored-By: Ross Barnowski <rossbar@berkeley.edu>
* Added note to angle function docstring about angle(0) being 0.Melissa Weber Mendonca2020-04-131-0/+5
|
* MAINT: simplify code that assumes str/unicode and int/long are different ↵Eric Wieser2020-03-261-1/+0
| | | | | types (#15816) Cleanup from the dropping of python 2
* DEP: Do not cast boolean indices to integers in np.delete (#15815)Eric Wieser2020-03-251-18/+24
| | | | | | | | This expires a deprecation from 1.8. The corresponding deprecation in `np.insert` has less clear semantics, so has been left to a future patch. Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net> Co-authored-by: Warren Weckesser <warren.weckesser@gmail.com>
* Merge pull request #15802 from eric-wieser/simplify-insertEric Wieser2020-03-241-20/+0
|\ | | | | DEP: Make `np.insert` and `np.delete` on 0d arrays with an axis an error
| * DEP: Make `np.insert` and `np.delete` on 0d arrays with an axis an errorEric Wieser2020-03-221-20/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change, the following code worked: ``` >>> some_0d = np.array(1) >>> np.insert(some_0d, "some nonsense", 10, axis=0) array(10) >>> np.insert(some_0d, "some nonsense", 42, axis="some nonsense") array(42) ``` Now these raise AxisError and TypeError, respectively. `delete` is exactly the same.
* | Merge pull request #15804 from eric-wieser/expire-delete-out-of-boundsSebastian Berg2020-03-231-17/+0
|\ \ | | | | | | DEP: Make np.delete on out-of-bounds indices an error
| * | DEP: Make np.delete on out-of-bounds indices an errorEric Wieser2020-03-221-17/+0
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note that this only affects lists of indices. ```python >>> a = np.arange(3) ```` Before: ```python >>> np.delete(a, 100) IndexError >>> np.delete(a, [100]) DeprecationWarning array([0, 1, 2]) >>> np.delete(a, -1) array([0, 1]) >>> np.delete(a, [-1]) FutureWarning array([0, 1, 2]) ``` After: ```python >>> np.delete(a, 100) IndexError >>> np.delete(a, [100]) IndexError >>> np.delete(a, -1) array([0, 1]) >>> np.delete(a, [-1]) array([0, 1]) ```
* | DEP: Forbid passing non-integral index arrays to `insert` and `delete`Eric Wieser2020-03-221-15/+0
|/ | | | This expires a deprecation warning from back in 1.9.
* MAINT: Make the axis logic for delete match insert.Eric Wieser2020-03-221-5/+4
| | | | No behavior change here unless someone implements a subclass where `arr.ravel().ndim == 0`, which no sane person would do anyway.
* MAINT: Add missing deprecation dates and versionsEric Wieser2020-03-221-1/+4
|
* MAINT: Remove some weird syntax for kwargsEric Wieser2020-03-221-1/+1
|
* MAINT: Add an explanatory comment for some weird codeEric Wieser2020-03-221-0/+2
|
* ENH: Add `subok` parameter to np.copy function (cf. gfh6509) (gh-15685)Ross Barnowski2020-03-111-3/+12
| | | | | This is largely a re-submission of the original change proposed in #6509. Discussion was hosted in multiple forums including #3474, the numpy mailing list circa 10-2015, and the 02-26-2020 NumPy Triage meeting. This PR closes #3474 and #15570
* BUG: Fixing result of np quantile edge caseEric Mariasis2020-02-281-1/+1
|
* BUG: fix doctest exception messagesmattip2020-02-281-1/+3
|
* STY: use 'yield from <expr>' for simple cases (#15444)Mike Taves2020-01-271-8/+4
| | | | | | | | | This PR uses simple cases of PEP 380 to rewrite: for v in g: yield v into: yield from <expr>
* MAINT: Revise imports from collections.abc moduleMike Taves2020-01-221-7/+2
|
* MAINT: Implement keyword-only arguments as syntaxEric Wieser2020-01-061-20/+7
| | | | Now that 2.7 is gone, there is no need to pop manually from kwarg dictionaries.
* MAINT: Remove implicit inheritance from object class (#15236)Jon Dufresne2020-01-051-1/+1
| | | | | | | 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.
* MAINT: Remove unnecessary 'from __future__ import ...' statementsJon Dufresne2020-01-031-2/+0
| | | | | As numpy is Python 3 only, these import statements are now unnecessary and don't alter runtime behavior.
* BUG: lib: Fix handling of integer arrays by gradient.Warren Weckesser2020-01-011-4/+13
| | | | | | | In numpy.gradient, convert integer array inputs to float64 to avoid unwanted modular arithmetic. Closes gh-15207.
* MAINT: lib: Clean up in function_base.py.Warren Weckesser2020-01-011-16/+13
| | | | | | * Remove conditional imports that handled Python 2. * Remove unused imports. * Partial PEP 8 clean up.
* DOC: lib: Use a clearer example of ddof in the notes of the cov docstring.Warren Weckesser2019-11-301-1/+1
| | | | | | Use `ddof = 1` instead of 9, and remove a confusing comment. Closes gh-15010.
* Merge pull request #14699 from mattip/doc-warningsRalf Gommers2019-10-181-1/+1
|\ | | | | MAINT: reduce the number of doc build warnings
| * DOC: convert `None` to bare None or ``None``mattip2019-10-151-1/+1
| |
* | DOC: Add to doc that interp cannot contain NaN (#14598)Zijie (ZJ) Poh2019-10-151-3/+7
|/ | | | | Address gh-13919 by adding to documentation that xp cannot contain NaN because its input is required to be sorted. Closes gh-13919
* DOC misleading np.sinc() documentationSamesh Lakhotia2019-10-021-7/+0
| | | | | | | The documentation currently states "It works in 2-D as well" with attached example not correct. closes #14466
* DEP: remove expired deprecation in selectmattip2019-09-231-21/+3
|
* DOC: Added missing versionadded to diff(prepend)Joseph R. Fox-Rabinovitz2019-09-181-2/+4
|
* DOC: lib: Add more explanation of the weighted average calculation.Warren Weckesser2019-08-261-2/+5
| | | | | Also removed the incorrect comment from the docstring of `numpy.ma.average` about the imaginary part of `weights` being ignored.
* DOC: Change (old) range() to np.arange()Dieter Werthmüller2019-07-111-3/+3
| | | I think it should be like that (maybe I am mistaken).
* BUG: i0 Bessel function regression on array-likes supporting ufuncsSebastian Berg2019-07-041-0/+1
| | | | | | | | | | For array likes supporting UFuncs, `np.abs` would return an array-like, and this is currently not compatible with the use of `np.piecewise`. The simplest fix seems to be to just call asanyarray (which piecewise calls anyway on the array) beforehand. This way we ensure the conditions are also an array. Fixes gh-13894
* Update function_base.pyHe Jia2019-06-141-1/+2
|