summaryrefslogtreecommitdiff
path: root/numpy/lib
Commit message (Collapse)AuthorAgeFilesLines
* TYP: Relax the `genfromtxt` return dtype when the dtype is unspecifiedBas van Beek2023-05-161-1/+1
|
* Merge pull request #23727 from F3eQnxN3RriK/doc-patch-2Charles Harris2023-05-141-15/+13
|\ | | | | DOC: Rewrite docstrings of `ogrid` and `mgrid`
| * DOC: Rewrite docstrings of `ogrid` and `mgrid`Yuki2023-05-061-15/+13
| | | | | | | | Removed references to `nd_grid` instead of adding a document (gh-23612).
* | Merge branch 'main' into deprecate-find-common-typeCharles Harris2023-05-1335-409/+1067
|\ \
| * | BUG: properly handle tuple keys in NpZFile.__getitem__ (#23757)Nathan Goldbaum2023-05-122-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | * BUG: properly handle tuple keys in NpZFile.__getitem__ * TST: test tuple rendering specifically. --------- Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
| * | MAINT: Reorganize the way windowing functions ensure float64 resultSebastian Berg2023-05-031-10/+38
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This roughly changes things so that we ensure a float64 working values up-front. There is a tiny chance of precision changes if the input was not float64 or error changes on bad input. I don't think this should matter in practice, precision changes (as far as I can tell) should happen rather the other way around. Since float64 has 53bits mantissa, I think the arange should give the correct result reliably for any sensible inputs. There is an argument to be made that the windowing functions could return float32 for float32 input, but I somewhat think this is OK and users can be expected to just cast manually after the fact. The result type is tested, but this ensures the tests pass also when enabling weak promotion.
| * TST: add tests for numpy.quantile (#23129)Christian Lorentzen2023-04-281-5/+100
| | | | | | | | | | | | | | | | | | | | 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.)
| * Merge pull request #23529 from lorentzenchr/doc_quantileSebastian Berg2023-04-282-10/+10
| |\ | | | | | | DOC: quantile parameter q is a probability
| | * DOC use percentage for q in percentileChristian Lorentzen2023-04-261-2/+2
| | |
| | * DOC quantile q is a probabilityChristian Lorentzen2023-04-042-8/+8
| | |
| * | EHN: add __contains__() to np.lib.npyio.NpzFilef380cedric2023-04-252-0/+4
| | | | | | | | | | | | | | | | | | | | | NpzFile inherits from collections.abc.Mapping, which provides __contains__(). However, it calls __getitem__(), which can be slow because it performs file decompression on success.
| * | Merge pull request #23555 from ngoldbaum/deprecate-np-mathRalf Gommers2023-04-081-2/+17
| |\ \ | | | | | | | | | | | | | | | | DEP: deprecate np.math and np.lib.math [skip ci]
| | * | DEP: deprecate np.math and np.lib.mathNathan Goldbaum2023-04-071-2/+17
| | | |
| * | | ENH: ``__repr__`` for NpzFile object (#23357)Ganesh Kathiresan2023-04-063-2/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improves the repr to include information about the arrays contained, e.g.: >>> npzfile = np.load('arr.npz') >>> npzfile NpzFile 'arr.npz' with keys arr_0, arr_1, arr_2, arr_3, arr_4... closes #23319 Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
| * | | Fixed failing testsMatteo Raso2023-04-012-16/+39
| | | |
| * | | Fixed docstring testMatteo Raso2023-04-011-1/+2
| | | |
| * | | Fixed edge case where pyfunc has no attribute `__doc__`Matteo Raso2023-04-011-1/+1
| | | | | | | | | | | | | | | | [skip circle] [skip azp] [skip cirrus]
| * | | Fixed edge case where pyfunc has no attribute `__name__`Matteo Raso2023-04-012-51/+134
| |/ /
| * | Revert "ENH: Enabled the use of numpy.vectorize as a decorator"Matti Picus2023-03-272-109/+11
| | |
| * | Merge pull request #23061 from MatteoRaso/vectorizeMatti Picus2023-03-262-11/+109
| |\ \ | | | | | | | | ENH: Enabled the use of numpy.vectorize as a decorator
| | * | @vectorize now requires arguments to specify keywordsMatteo Raso2023-02-092-27/+15
| | | | | | | | | | | | | | | | This reverses commit 7a2ded1522305
| | * | Added a test for positional args (PR-23061)Matteo Raso2023-02-082-0/+30
| | | |
| | * | Added test for vectorize decorator projectMatteo Raso2023-01-271-0/+8
| | | | | | | | | | | | | | | | | | | | This test makes sure a function's docstring is properly preserved after calling the vectorize decorator.
| | * | Changed documentation for numpy.vectorizeMatteo Raso2023-01-241-1/+1
| | | | | | | | | | | | | | | | | | | | Previous definition implies that vectorize returns generalized functions, which is not true.
| | * | Fixed lint errorMatteo Raso2023-01-211-1/+1
| | | |
| | * | ENH: Enabled use of numpy.vectorize as decorator (#9477)Matteo Raso2023-01-212-12/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | BUG: Added __name__ atribute to vectorize class (#23021)Matteo Raso2023-01-182-0/+8
| | | |
| * | | MAINT: Fix reference roles of astyuki2023-03-251-5/+5
| | | |
| * | | MAINT: Fix reference roles of `ast`yuki2023-03-251-7/+7
| | | |
| * | | DOC: fix extra space in error messageBerke Kocaoğlu2023-03-161-1/+1
| | | |
| * | | MAINT: remove `NUMPY_EXPERIMENTAL_ARRAY_FUNCTION` env varRalf Gommers2023-03-123-34/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As discussed in https://mail.python.org/archives/list/numpy-discussion@python.org/thread/UKZJACAP5FUG7KP2AQDPE4P5ADNWLOHZ/ This flag was always meant to be temporary, and cleaning it up is long overdue.
| * | | DEP: expire deprecation for "y as out" in fix/isposinf/isneginfRalf Gommers2023-03-122-65/+1
| | |/ | |/|
| * | DOC: Add 'may vary' markup in info() docstring.warren2023-03-071-1/+1
| | | | | | | | | | | | [skip actions] [skip travis] [skip cirrus]
| * | DOC: Edit top line of info() docstring to mention array.warren2023-03-071-1/+1
| | | | | | | | | | | | [skip actions] [skip travis] [skip azp] [skip cirrus]
| * | DOC: Document that info() handles array instances.warren2023-03-071-4/+21
| | | | | | | | | | | | [skip actions] [skip travis] [skip azp] [skip cirrus]
| * | TYP: Remove some stray type-check-only imports of `msort`BvB932023-03-051-1/+0
| | |
| * | DEP: deprecate `product`, `cumproduct`, `sometrue`, `alltrue`Ralf Gommers2023-03-023-15/+14
| | | | | | | | | | | | [skip cirrus]
| * | DOC: Fixed meshgrid docstring return type (#23310)Miki Watanabe2023-03-011-2/+2
| | | | | | | | | | | | | | | Meshgrid returns a list of ndarrays. Co-authored-by: 渡邉 美希 <miki.watanabe@watanabenoMacBook-Pro.local>
| * | TYP,MAINT: Add a missing explicit Any parameterFrancesc Elies2023-02-211-1/+1
| | |
| * | DOC: Fix matpltolib error in documentation (#23212)Sebastian Berg2023-02-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | As noted by Kyle Sunden, this was deprecated and has been removed, using the method is the correct way of doing it in newer matplotlib. Closes gh-23209 Co-authored-by: Kyle Sunden <ksunden@users.noreply.github.com>
| * | Merge pull request #23089 from seberg/numpy2-flagMatti Picus2023-02-122-0/+9
| |\ \ | | | | | | | | API: Add environment variable for behavior planned in a 2.0
| | * | MAINT: Use `np._using_numpy2_behavior()` and initialize it in CSebastian Berg2023-02-102-2/+2
| | | |
| | * | API: Modify `gradient` to return a tuple rather than a listSebastian Berg2023-02-102-0/+9
| | | | | | | | | | | | | | | | | | | | 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.
| * | | Fix typos found by copdespellDimitri Papadopoulos2023-02-111-1/+1
| | | |
| * | | MAINT, DOC: string_ → bytes_ and unicode_ → str_Dimitri Papadopoulos2023-02-103-15/+15
| |/ /
| * | Merge pull request #23113 from hmaarrfk/slots_for_mixinsSebastian Berg2023-01-271-0/+1
| |\ \ | | | | | | | | ENH: Add slots to NDArrayOperatorsMixin allowing them in subclasses
| | * | ENH: Add slots to NDArrayOperatorsMixin to make subclsasing smootherMark Harfouche2023-01-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I use the mixings in a few different file backed arrays. However, the lack of slots make it difficult for me to use slots. I mostly use slots to ensure that performance optimized code doesn't create unecessary references to large chunks of memory. If all parent classes do not have `__slots__` defined, I think that Python (3.9) just ignores `__slots__` alltogether. Thank you for considering.
| * | | API: Raise EOFError when trying to load past the end of a `.npy` file (#23105)Noé Rubinstein2023-01-272-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the following code: ``` import numpy as np with open('foo.npy', 'wb') as f: for i in range(np.random.randint(10)): np.save(f, 1) with open('foo.npy', 'rb') as f: while True: np.load(f) ``` Will raise: ``` ValueError: Cannot load file containing pickled data when allow_pickle=False ``` While there is no pickled data in the file.
| * | | Merge branch 'main' into document_diag_indices_fromRoss Barnowski2023-01-2526-229/+595
| |\ \ \
| | * | | DOC, ENH: Improve docstring of real_if_close (#23087)Pieter Eendebak2023-01-251-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | * fix docstring of real_if_close * factor out dtype