summaryrefslogtreecommitdiff
path: root/numpy/lib/shape_base.py
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* DOC: Fix typo in a dsplit() error message.Chris Ball2014-02-131-1/+1
|
* BUG: Fix array_split empty array type and add FutureWarningSebastian Berg2013-12-201-7/+13
| | | | | | | | | | | | | | | | | Fixes the result type of empty output arrays. The FutureWarning warns about changed behaviour. A "kludge" was introduced into array split converting converting the result of something like: >>> np.array_split(np.array([[1, 1]]), 2) [array([[1, 1]]), array([], dtype=int64)] instead of retaining the shape of the empty/second array to be (0, 2). A FutureWarning is now raised when such a replacement occurs. Closes gh-612
* STY: Giant comma spacing fixup.Charles Harris2013-08-181-31/+31
| | | | | | | Run the 2to3 ws_comma fixer on *.py files. Some lines are now too long and will need to be broken at some point. OTOH, some lines were already too long and need to be broken at some point. Now seems as good a time as any to do this with open PRs at a minimum.
* STY: Style fixes for integer deprecation changesSebastian Berg2013-06-091-1/+1
| | | | Also minor changes in the documentation.
* MAINT: adept divisions for truedivideSebastian Berg2013-05-311-1/+1
| | | | Following deprecations would cause problems otherwise.
* Merge pull request #3264 from endolith/patch-1Charles Harris2013-05-041-8/+5
|\ | | | | DOC: Change example to demonstrate function
| * DOC: Change example to demonstrate functionendolith2013-04-191-8/+5
| | | | | | "a * 0.5" example might as well be new_func(a) directly, it doesn't demonstrate the purpose of apply_along_axis().
* | MAINT: Apply 2to3 idioms fixer.Charles Harris2013-05-021-6/+4
|/ | | | | | | | | | | | | | | | | | | The idioms fixer makes the following replacements. 1) int <- bool 2) comparison or identity of types <- isinstance 3) a.sort() <- sorted(a) There were two problems that needed to be dealt with after the application of the fixer. First, the replacement of comparison or identity of types by isinstance was not always correct. The isinstance function returns true for subtypes whereas many of the places where the fixer made a substitution needed to check for exact type equality. Second, the sorted function was applied to arrays, but because it treats them as iterators and constructs a sorted list from the result, that is the wrong thing to do. Closes #3062.
* 2to3: Apply `map` fixer.Charles Harris2013-04-101-1/+1
| | | | | | | | | | | | | | | | | | | In Python 3 `map` is an iterator while in Python 2 it returns a list. The simple fix applied by the fixer is to inclose all instances of map with `list(...)`. This is not needed in all cases, and even where appropriate list comprehensions may be preferred for their clarity. Consequently, this patch attempts to use list comprehensions where it makes sense. When the mapped function has two arguments there is another problem that can arise. In Python 3 map stops execution when the shortest argument list is exhausted, while in Python 2 it stops when the longest argument list is exhausted. Consequently the two argument case might need special care. However, we have been running Python3 converted versions of numpy since 1.5 without problems, so it is probably not something that affects us. Closes #3068
* 2to3: Apply `print` fixer.Charles Harris2013-04-061-1/+1
| | | | | | | Add `print_function` to all `from __future__ import ...` statements and use the python3 print function syntax everywhere. Closes #3078.
* Merge pull request #460 from endolith/regex_formattingCharles Harris2013-04-031-2/+0
|\ | | | | DOC: Formatting fixes using regex
| * DOC: Used regex to find colons missing spaces which render wrong online, ↵endolith2013-03-191-2/+0
| | | | | | | | also other spacing or formatting mistakes
* | 2to3: Use absolute imports.Charles Harris2013-03-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new import `absolute_import` is added the `from __future__ import` statement and The 2to3 `import` fixer is run to make the imports compatible. There are several things that need to be dealt with to make this work. 1) Files meant to be run as scripts run in a different environment than files imported as part of a package, and so changes to those files need to be skipped. The affected script files are: * all setup.py files * numpy/core/code_generators/generate_umath.py * numpy/core/code_generators/generate_numpy_api.py * numpy/core/code_generators/generate_ufunc_api.py 2) Some imported modules are not available as they are created during the build process and consequently 2to3 is unable to handle them correctly. Files that import those modules need a bit of extra work. The affected files are: * core/__init__.py, * core/numeric.py, * core/_internal.py, * core/arrayprint.py, * core/fromnumeric.py, * numpy/__init__.py, * lib/npyio.py, * lib/function_base.py, * fft/fftpack.py, * random/__init__.py Closes #3172
* | 2to3: Replace xrange by range and use list(range(...)) where neededCharles Harris2013-03-271-2/+2
|/ | | | | | | | | | | | | | | In python3 range is an iterator and `xrange` has been removed. This has two consequence for code: 1) Where a list is needed `list(range(...))` must be used. 2) `xrange` must be replaced by `range` Both of these changes also work in python2 and this patch makes both. There are three places fixed that do not need it, but I left them in so that the result would be `xrange` clean. Closes #3092
* 2to3: Put `from __future__ import division in every python file.Charles Harris2013-03-011-0/+2
| | | | | | | | This should be harmless, as we already are division clean. However, placement of this import takes some care. In the future a script can be used to append new features without worry, at least until such time as it exceeds a single line. Having that ability will make it easier to deal with absolute imports and printing updates.
* DOC: Fix outdated docstring.Tony S Yu2012-04-091-5/+5
| | | | Equal and nearly-equal size requirement is not true when passing a 1-D array of indices.
* DOC: merge wiki doc edits.Ralf Gommers2012-03-031-2/+2
|
* STY: Fix up some two line old-style exceptions.Charles Harris2011-04-051-2/+2
|
* STY: Update exception style, easy ones.Charles Harris2011-04-051-5/+5
|
* DOC: wiki merge, twodim_base and a few loose ones.rgommers2010-07-311-9/+8
|
* more docstring updates from pydoc website (thanks to everyone who contributed!)Jarrod Millman2010-02-171-7/+7
|
* fixed a whole bunch of doctestsPaul Ivanov2009-12-281-3/+3
|
* All non core regressions tests moved to their respective modules.David Cournapeau2009-09-161-257/+2
|
* add support for __array_prepare__Darren Dale2009-08-231-1/+17
|
* Merge from doc wikiPauli Virtanen2009-06-191-16/+15
|
* Merge from the doc wikiPauli Virtanen2009-03-241-120/+166
|
* Import documentation from doc wiki (part 2, work-in-progress docstrings, but ↵Pauli Virtanen2008-10-281-22/+50
| | | | they are still an improvement)
* Merge from documentation editor.Stefan van der Walt2008-08-051-311/+689
|
* Use the implicit "import numpy as np" made available to all doctests instead Alan McIntyre2008-07-051-37/+33
| | | | | of explicit imports or dependency on the local scope where the doctest is defined..
* Use the implicit "import numpy as np" made available to all doctests instead ↵Alan McIntyre2008-07-031-3/+2
| | | | | | | of an explicit import. Remove ">>>" from bartlett plotting example since it currently requires matplotlib.
* ran reindent.py to clean up whitespaceJarrod Millman2007-10-291-1/+1
|
* Tile empty arrays.Stefan van der Walt2007-07-101-2/+2
|