summaryrefslogtreecommitdiff
path: root/numpy/lib/shape_base.py
Commit message (Collapse)AuthorAgeFilesLines
* BUG: fix array_split incorrect behavior with array size bigger MAX_INT32 ↵Nikita Titov2018-08-261-2/+2
| | | | | | | | | | | | (#11813) Fixes #11809. * BUG: fix array_split incorrect behavior with array size bigger MAX_INT32 * TST: added test for array_split with array size greater MAX_INT32 * addressed review comments
* ENH: Make expand_dims work on subclassesEric Wieser2018-07-291-1/+5
| | | | This allows np.ma.expand_dims to be removed
* ENH: Add (put|take)_along_axis as described in #8708Eric Wieser2018-05-251-1/+226
| | | | This is the reduced version that does not allow any insertion of extra dimensions
* DOC: Add missing np. prefix to expand_dims docs (#10109)Hidehiro NAGAOKA2017-11-281-3/+3
|
* Merge pull request #9946 from eric-wieser/improve-take-docsAllan Haldane2017-11-281-5/+23
|\ | | | | DOC: describe the expansion of take and apply_along_axis in detail
| * DOC: describe the expansion of take and apply_along_axis in detailEric Wieser2017-11-211-5/+23
| | | | | | | | | | | | Extracted from gh-8714 [ci-skip]
* | DOC: v/h/dstack docstr shouldn't imply deprecationAllan Haldane2017-11-211-15/+11
|/ | | | [ci skip]
* Clarify docstring for numpy.array_splitDavid Linke2017-10-281-1/+7
| | | Before this addition, people could expect that only the last sub-array would have a different size. The added documentation and example make clear what the function really does.
* MAINT: Remove unused isscalar importEric Wieser2017-10-211-1/+1
|
* DOC: Fixed doctest of apply along axis with 3D returnMichael Seifert2017-09-061-2/+0
| | | | [skip ci]
* DEP: Deprecate incorrect behavior of expand_dims.Charles Harris2017-05-171-3/+18
| | | | | | | | | | | Expand_dims works as documented when the index of the inserted NewAxis in the resulting array satisfies -a.ndim - 1 <= index <= a.ndim. However, when index > a.ndim index is replaced by a.ndim and, when index < -a.ndim - 1, it is replaced by index + a.ndim + 1, which may be negative and results in incorrect placement. The latter two cases are now deprecated. Closes #9100.
* DOC: link to stack from column_stackEric Wieser2017-05-131-1/+1
| | | | [ci skip]
* ENH: Spelling fixesVille Skyttä2017-05-091-1/+1
|
* Merge pull request #8643 from eric-wieser/fix-8642Eric Wieser2017-04-111-1/+3
|\ | | | | BUG: Fix double-wrapping of object scalars
| * BUG: Fix double-wrapping of object scalarsEric Wieser2017-04-061-1/+3
| | | | | | | | Fixes #8642
* | Merge pull request #8737 from eric-wieser/squeeze-expand-docsCharles Harris2017-04-011-0/+2
|\ \ | | | | | | DOC: Mention that expand_dims and squeeze are inverses
| * | DOC: expand_dims and squeeze are inversesEric Wieser2017-03-061-0/+2
| | | | | | | | | | | | [ci skip]
* | | DOC: Spell out note for `dstack`Søren Fuglede Jørgensen2017-03-261-1/+2
|/ / | | | | This adds to the documentation on `dstack` the notes from `hstack` and `vstack` about dimensionality requirements.
* | MAINT: replace len(x.shape) with x.ndimEric Wieser2017-02-241-5/+5
| |
* | MAINT: Use normalize_axis_index in all python axis checkingEric Wieser2017-02-201-6/+3
|/ | | | | | | As a result, some exceptions change from ValueError to IndexError This also changes the exception types raised in places where normalize_axis_index is not quite appropriate
* BUG: Don't leak internal exceptions when given an empty arrayEric Wieser2017-02-131-1/+4
| | | | Fixes #7454
* MAINT: Improve error-checking of axis argumentEric Wieser2017-02-111-3/+2
| | | | Copied from the implementation in core.shape_base.stack
* MAINT: Transpose the result, rather than working with a transposed viewEric Wieser2017-02-111-23/+34
| | | | | | | .transpose does not specify that it must return a view, so subclasses (like np.ma.array) could otherwise break this. This exposes some more need for matrix special casing.
* BUG: Work around evil matrix.__array_prepare__Eric Wieser2017-02-111-1/+6
|
* BUG: Call __array_prepare__ before __array_wrap__Eric Wieser2017-02-111-1/+4
|
* MAINT: Use np.ndindex, which seems just as efficientEric Wieser2017-02-111-18/+8
|
* BUG: Fix crash on 0d return value in apply_along_axisEric Wieser2017-02-111-58/+63
| | | | | | Also: ENH: Support arbitrary dimensionality of return value MAINT: remove special casing
* BUG: Fix apply_along_axis() for when func1d() returns a non-ndarray (#8426)Ben Rowland2016-12-311-1/+1
| | | | | | | | | | | | * BUG: Closes issue #8419 Fixes issue in apply_along_axis() where func1d() returns a non ndarray * BUG: Fix apply_along_axis() when func1d() returns a non-ndarray Closes issue #8419. Fixes issue in apply_along_axis() where func1d() returns a non ndarray by calling asanyarray() on result. This commit fixes a too long line in the test case.
* ENH: allow numpy.apply_along_axis() to work with ndarray subclasses (#7918)Ben Rowland2016-10-111-3/+7
| | | | | | | This commit modifies the numpy.apply_along_axis() function so that if it is called with an ndarray subclass, the internal func1d calls receive subclass instances and the overall function returns an instance of the subclass. There are two new tests for these two behaviours.
* DOC: apply_along_axis missing whitespace inserted before colonMichael Seifert2016-02-181-1/+1
| | | | | The missing whitespace lead to inconsistent rendering in the online documentation. [ci skip]
* DOC: rewrite stack/concatenate reference in h/v/dstackAuke Wiggers2016-02-161-2/+2
|
* DOC: note in h/v/dstack points users to stack/concatenateauke2016-02-151-0/+4
|
* added more textJulien Lhermitte2015-11-051-0/+4
|
* added extra line in the tile help doc to outline a general repeat, commonly usedJulien Lhermitte2015-11-041-0/+6
|
* DEP: Remove FutureWarning from np.lib.split and go to future.Charles Harris2015-10-301-10/+1
| | | | | | | | | | | | | | | Previously an empty array resulting from split always had dimension 1-D. In Numpy 1.9 a FutureWarning was raised to notify users that it was planned to preserve the dimensions of empty arrays in a future numpy release. This removes the FutureWarning and implements preservation of dimensions. Note that there was a bug in numpy 1.9 and the dimensions of empty arrays was already preserved in some cases and no warning was issued. This PR fixes that inconsistency by preserving the dimensions in all cases rather than fixing the bug, as the dimension preserving behavior was already depended on by some users. See the discussion in gh-6575 about this change.
* Merge pull request #6371 from seberg/pr-5771Charles Harris2015-09-271-1/+1
|\ | | | | BUG: Make sure warning for array split is always applied
| * BUG: Expanded warning conditions for array_splitMichael Currie2015-09-271-1/+1
| | | | | | | | | | | | | | | | Zero arrays can also occur with any of the partitions sub_arys[i] induced by array_split, not just the final partition sub_arys[-1]. Modified by seberg. Closes gh-5771
* | BUG: Fix tiling of zero-sized arrays numpy/numpy#6089 and add test case.Dimas Abreu Dutra2015-07-171-10/+10
| |
* | Merge pull request #5605 from shoyer/stackCharles Harris2015-05-121-2/+4
|\ \ | |/ |/| ENH: add np.stack
| * ENH: add np.stackStephan Hoyer2015-05-111-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The motivation here is to present a uniform and N-dimensional interface for joining arrays along a new axis, similarly to how `concatenate` provides a uniform and N-dimensional interface for joining arrays along an existing axis. Background ~~~~~~~~~~ Currently, users can choose between `hstack`, `vstack`, `column_stack` and `dstack`, but none of these functions handle N-dimensional input. In my opinion, it's also difficult to keep track of the differences between these methods and to predict how they will handle input with different dimensions. In the past, my preferred approach has been to either construct the result array explicitly and use indexing for assignment, to or use `np.array` to stack along the first dimension and then use `transpose` (or a similar method) to reorder dimensions if necessary. This is pretty awkward. I brought this proposal up a few weeks on the numpy-discussion list: http://mail.scipy.org/pipermail/numpy-discussion/2015-February/072199.html I also received positive feedback on Twitter: https://twitter.com/shoyer/status/565937244599377920 Implementation notes ~~~~~~~~~~~~~~~~~~~~ The one line summaries for `concatenate` and `stack` have been (re)written to mirror each other, and to make clear that the distinction between these functions is whether they join over an existing or new axis. In general, I've tweaked the documentation and docstrings with an eye toward pointing users to `concatenate`/`stack`/`split` as a fundamental set of basic array manipulation routines, and away from `array_split`/`{h,v,d}split`/`{h,v,d,column_}stack` I put this implementation in `numpy.core.shape_base` alongside `hstack`/`vstack`, but it appears that there is also a `numpy.lib.shape_base` module that contains another larger set of functions, including `dstack`. I'm not really sure where this belongs (or if it even matters). Finally, it might be a good idea to write a masked array version of `stack`. But I don't use masked arrays, so I'm not well motivated to do that.
* | Update shape_base.pyKreiswolke2015-03-111-2/+2
| | | | | | So removed the paranthesis and included the return statement.
* | BUG: Fixed issue #4679 and added testOliver Eberle2015-02-191-1/+6
|/ | | | | Tile now copies the input when it is a numpy array and all dimensions are repeated only once.
* Fix 'dimensions' typo in numpy.kron() help messageSandro Tosi2015-02-061-1/+1
| | | | This bug was reported in Debian as: http://bugs.debian.org/777172 .
* STY: Make files in numpy/lib PEP8 compliant.Charles Harris2014-07-311-11/+17
| | | | The rules enforced are the same as those used for scipy.
* MAINT: Fixes for problems in numpy/lib revealed by pyflakes.Charles Harris2014-07-311-7/+12
| | | | | | 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 #4454 from jurnix/namedargsJulian Taylor2014-06-081-4/+9
|\ | | | | ENH: apply_along_axis accepts named arguments
| * PEP8 nitpicksjurnix2014-06-061-4/+7
| |
| * ENH: apply_along_axis accepts named argumentsAlbert2014-03-271-4/+6
| |
* | DOC/FIX: Fix error in documentationYoshiki Vázquez Baeza2014-05-041-4/+0
|/ | | | | | | Remove misleading note about equivalency betwen column_stack and np.vstack(tup).T. Fixes #3488
* DOC: document equivalence of apply_over_axes and tuple axis ufuncsJulian Taylor2014-03-041-0/+13
|