summaryrefslogtreecommitdiff
path: root/numpy
Commit message (Collapse)AuthorAgeFilesLines
* MAINT: Remove duplicated code in iotools.pyEric Wieser2020-03-311-37/+22
|
* Merge pull request #15812 from eric-wieser/expire-delete-out-of-boundsSebastian Berg2020-03-231-1/+5
|\ | | | | TST: Remove code that is not supposed to warn out of warning assertion
| * TST: Remove code that is not supposed to warn out of warning assertionEric Wieser2020-03-231-1/+5
| |
* | Merge pull request #15804 from eric-wieser/expire-delete-out-of-boundsSebastian Berg2020-03-232-22/+4
|\ \ | |/ | | DEP: Make np.delete on out-of-bounds indices an error
| * DEP: Make np.delete on out-of-bounds indices an errorEric Wieser2020-03-222-22/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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]) ```
* | Merge pull request #15805 from eric-wieser/expired-insert-delete-TypeErrorSebastian Berg2020-03-232-15/+12
|\ \ | | | | | | DEP: Forbid passing non-integral index arrays to `insert` and `delete`
| * | DEP: Forbid passing non-integral index arrays to `insert` and `delete`Eric Wieser2020-03-222-15/+12
| |/ | | | | | | This expires a deprecation warning from back in 1.9.
* | Merge pull request #15799 from eric-wieser/simplify-insertSebastian Berg2020-03-221-7/+11
|\ \ | |/ | | MAINT: Cleanups to np.insert and np.delete
| * 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
| |
* | DEP: Make issubdtype consistent for types and dtypes (#15773)Sebastian Berg2020-03-222-28/+29
| | | | | | | | | | | | | | | | | | | | This finishes the deprecation started in gh-9505 removing behaviour that allowed strings/types representing specific dtypes to behave like their more generic supertypes (e.g. the python float would map to floating instead of float64 which it typically maps to). Co-Authored-By: Eric Wieser <wieser.eric@gmail.com>
* | BUG, TST: fix f2py for PyPy, skip one test for PyPy (#15750)Matti Picus2020-03-1810-43/+45
| | | | | | * BUG, TST: fix f2py for PyPy, skip one test for PyPy, xfail tests for s390x
* | BUG: Guarantee array is in valid state after memory error occurs in getset.c ↵Mibu2872020-03-181-7/+13
|/ | | | | | | | | | | (#15736) Currently, in function array_shape_set, ndarray's pointers to dimensions and strides are freed before new array is allocated (Line 71). In case memory error occur, the array is left with dangling pointers. Therefore, we can not recover from such error. * To guarantee array in valid state when memory error occur * Fix: Free cache when nd == 0 to avoid memory leak * Update numpy/core/src/multiarray/getset.c Co-Authored-By: Eric Wieser <wieser.eric@gmail.com>
* MAINT: remove useless `global` statementsEric Wieser2020-03-186-9/+2
| | | | | | | `global` is only needed if a variable appears on the left of an assignment. These variables do not. Most suffer from the misconception that `var[x] = y` requires `var` to be global, but it does not.
* Merge pull request #15766 from seberg/simplify-specialized-castsMatti Picus2020-03-183-75/+30
|\ | | | | BUG,MAINT: Remove incorrect special case in string to number casts
| * BUG: Increase default string cast size of longdouble/clongdoubleSebastian Berg2020-03-161-2/+6
| |
| * BUG,MAINT: Remove incorrect special case in string to number castsSebastian Berg2020-03-162-73/+24
| | | | | | | | | | | | | | | | | | The string to number casts fall back to using the scalars and the type setitem function to do the cast. However, before calling setitem, they sometimes already called the Python function for string coercion. This is unnecessary. Closes gh-15608
* | BUG: add missing c_distributions.pxd, enables cython use of random C-API ↵Matti Picus2020-03-1612-149/+245
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (gh-15463) xref gh-14778 As pointed out in the comment by @jamesthomasgriffin, we did not include a pxd file to expose the distribution functions documented in the random c-api. This PR adds a c_distributions.pxd file that exposes them. Squashed commits: * BUG: add missing c_distributions.pxd to enable cython use of random C-API * ENH, TST: add npyrandom library like npymath, test cython use of it * BUG: actually prefix f-string with f * MAINT: fixes from review, add _bit_generato_bit_generator.pxd * STY: fixes from review * BLD: don't use nprandom library for mtrand legacy build * TST: WindowsPath cannot be used in subprocess's list2cmdline * MAINT, API: move _bit_generator to bit_generator * DOC: add release note about moving bit_generator * DOC, MAINT: fixes from review * MAINT: redo dtype determination from review
* | MAINT: Test during import to detect bugs with Accelerate(MacOS) LAPACK (#15695)Rakesh Vasudevan2020-03-151-0/+32
| | | | | | | | | | | | | | * TST: Test during import to detect bugs with Accelerate(MacOS) LAPACK fixes #15647 * Pipeline update for Accelerate(MacOS) testing
* | MAINT: lib: PEP-8 clean up in test_arraysetops.py.Warren Weckesser2020-03-151-38/+41
| |
* | BUG: lib: Handle axes with length 0 in np.unique.Warren Weckesser2020-03-152-4/+22
| | | | | | | | | | | | | | Tweak a few lines so that arrays with an axis with length 0 don't break the np.unique code. Closes gh-15559.
* | TST: lib: Add a unit test for np.unique applied to arrays with a length 0 axis.Huon Wilson2020-03-151-0/+35
| | | | | | | | | | This code is from github user huonw, from this PR: https://github.com/numpy/numpy/pull/15565
* | MAINT: Add better error handling in linalg.norm for vectors and clarify it ↵Jim2020-03-123-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | in documentation (#15740) * Clarify `fro` and `nuc` usage in linalg.norm documentation (see #15533). * Add improved error handling when getting Frobenius norm from a vector (see #15533). * Fix comment in linalg norm test. Closes gh-15533.
* | DOC: Do not complain about contiguity when mutating `ndarray.shape` (gh-10600)John Han2020-03-123-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There are multiple conditions that `_attempt_nocopy_reshape` checks for when ndarray.shape is mutated directly. Discussion of #10146 indicated that an error message referencing any type of contiguity would not be correct for all cases, so the error message has been changed to be more general. * ENH: shorten message and use "in-place" * MAINT: typo from review Co-authored-by: hanjohn <hanjohn@users.noreply.github.com> Co-authored-by: mattip <matti.picus@gmail.com>
* | DOC: Refactor `np.polynomial` docs using `automodule` (#15662)Ross Barnowski2020-03-126-220/+306
| | | | | | * DOC: Refactor polynomial docs using automodule.
* | ENH: Add `subok` parameter to np.copy function (cf. gfh6509) (gh-15685)Ross Barnowski2020-03-112-3/+19
| | | | | | | | | | 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
* | MAINT: Remove non-native byte order from _var check.Ross Barnowski2020-03-101-4/+0
| | | | | | | | | | | | | | | | Removes unnecessary code introduced in #15696. Non-native byte orders were explicitly added to the fast-path check in _var for complex numbers. However, the non-native path is unreachable due to coercion in upstream ufuncs.
* | Merge pull request #15696 from rossbar/enh/var_complex_fastpathSebastian Berg2020-03-102-0/+56
|\ \ | | | | | | MAINT: Add a fast path to var for complex input
| * | ENH: Adds a fast path to var for complex inputRoss Barnowski2020-03-092-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | var currently has a conditional that results in conjugate being called for the variance calculation of complex inputs. This leg of the computation is slow. This PR avoids this computational leg for complex inputs via a type check. Closes #15684
* | | Merge pull request #15706 from melissawm/f2py-typos-fixCharles Harris2020-03-083-8/+8
|\ \ \ | | | | | | | | MAINT: Fixing typos in f2py comments and code.
| * | | Fixing typos in f2py comments and code.Melissa Weber Mendonca2020-03-043-8/+8
| |/ /
* | | BUG: fix logic error when nm fails on 32-bitmattip2020-03-081-4/+7
| | |
* | | MAINT: use list-based APIs to call subprocesses (#15714)Sebastian Berg2020-03-074-34/+79
| |/ |/| | | | | | | | | * MAINT: use list-based APIs to call subprocesses * TST, MAINT: add a test for mingw32ccompiler.build_import, clean up lib2def Co-authored-by: Matti Picus <matti.picus@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
* | Merge pull request #15534 from seberg/deprecate-abstract-scalar-typesMatti Picus2020-03-068-21/+116
|\ \ | | | | | | DEP: Do not allow "abstract" dtype conversion/creation
| * | Update numpy/core/src/multiarray/descriptor.cSebastian Berg2020-03-041-1/+1
| | | | | | | | | Co-Authored-By: Matti Picus <matti.picus@gmail.com>
| * | Fixup: Do not deprecate generic python typesSebastian Berg2020-02-076-21/+18
| | | | | | | | | | | | | | | Add a comment that we can think about only allowing it for `dtype=...` though...
| * | DEP: Do not allow "abstract" dtype conversion/creationSebastian Berg2020-02-0612-26/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These dtypes do not really make sense as instances. We can (somewhat) reasonably define np.dtype(np.int64) as the default (machine endianess) int64. (Arguably, it is unclear that `np.array(arr_of_>f8, dtype="f")` should return arr_of_<f8, but that would be very noisy!) However, `np.integer` as equivalent to long, is not well defined. Similarly, `dtype=Decimal` may be neat to spell `dtype=object` when you intend to put Decimal objects into the array. But it is misleading, since there is no special meaning to it at this time. The biggest issue with it, is that `arr.astype(np.floating)` looks like it will let float32 or float128 pass, but it will force a float64 output! Arguably downcasting is a bug in this case. A related issue is `np.dtype("S")` and especially "S0". The dtype "S" does make sense for most or all places where `dtype=...` can be passed. However, it is conceptionally different from other dtypes, since it will not end up being attached to the array (unlike "S2" which would be). The dtype "S" really means the type number/DType class of String, and not a specific dtype instance.
* | | Merge pull request #15487 from ericmariasis/quantileSebastian Berg2020-03-042-1/+11
|\ \ \ | | | | | | | | BUG: Fixing result of np quantile edge case
| * | | BUG: Fixing result of np quantile edge caseEric Mariasis2020-02-282-1/+11
| | | |
* | | | convert shebang from python to python3 (#15687)Changqing Li2020-03-0429-29/+29
| |_|/ |/| | | | | | | | Signed-off-by: Changqing Li <changqing.li@windriver.com>
* | | DOC: Improve np.finfo docs (#15678)Ross Barnowski2020-03-011-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * DOC: Improve docs for np.finfo. Replace inaccurate statements about eps and epsneg attrs with correct statements and examples. Added np.spacing and np.nextafter to See Also. Closes #6940. * Removed LaTeX math from finfo docstring. * MAINT: Add periods at end of some sentences. Co-authored-by: Charles Harris <charlesr.harris@gmail.com>
* | | FIXME -> NOTE: more precise language in comment.Ross Barnowski2020-03-011-2/+2
| | | | | | | | | | | | Reference multiple relevant discussions on GH
* | | MAINT: Added comment pointing FIXME to relevant PR.Ross Barnowski2020-03-011-0/+1
| | | | | | | | | | | | | | | | | | | | | Clarifies a FIXME comment in numpy/__init__.py by referencing relevant discussion in issue tracker. Closes #15668.
* | | DOC: Update to clarify actual behavior real_if_(all elements)_close (gh-15644)and-sang2020-02-281-5/+6
|/ / | | | | | | | | | | Updated the description to consider all array elements Updated the examples to use multiple elements array, to show that one element not close enough prevent for the whole array to be considered as real Closes #15626
* | BUG: fix doctest exception messagesmattip2020-02-283-7/+16
| |
* | Merge pull request #12646 from shoyer/refguide-check-exceptionsMatti Picus2020-02-281-2/+3
|\ \ | | | | | | TST: check exception details in refguide_check.py
| * | TST: check exception details in refguide_check.pyStephan Hoyer2019-01-011-2/+3
| | | | | | | | | | | | xref GH-12548
* | | Merge pull request #15504 from emmanuelle/patch-1Matti Picus2020-02-281-4/+1
|\ \ \ | | | | | | | | DOC: Remove duplicated code in true_divide docstring