summaryrefslogtreecommitdiff
path: root/numpy/lib/index_tricks.py
Commit message (Collapse)AuthorAgeFilesLines
...
* | MAINT/DOC: Use builtin when np.{x} is builtins.{x}.Eric Wieser2017-08-051-1/+1
| | | | | | | | | | | | | | This is the case for x in {int, bool, str, float, complex, object}. Using the np.{x} version is deceptive as it suggests that there is a difference. This change doesn't affect any external behaviour. The `long` type is missing in python 3, so np.long is still useful
* | BUG: KeyboardInterrupt is swallowed all over the placeEric Wieser2017-06-031-1/+1
| | | | | | | | Bare except is very rarely the right thing
* | ENH: Spelling fixesVille Skyttä2017-05-091-1/+1
| |
* | BUG: np.ma.mr_['r',...] does not return masked arraysEric Wieser2017-05-051-3/+3
| |
* | BUG: np.r_['r',...] crashes on scalarsEric Wieser2017-05-051-1/+1
| |
* | BUG: np.r_['rc'] is treated as np.r_['r'], not an errorEric Wieser2017-05-051-1/+1
| |
* | MAINT: Use enumerate instead of range(len(...))Eric Wieser2017-05-051-15/+14
| |
* | BUG: Remove mutable state from AxisConcatenatorEric Wieser2017-05-051-29/+26
| | | | | | | | Fixes #8815
* | MAINT: Remove code duplicated from np.r_ in np.ma.mr_Eric Wieser2017-05-051-1/+3
| | | | | | | | | | Also adds a test for the disabled-by-design behaviour - this would return raw matrices, not masked arrays
* | DOC: Added “See Also” section for c_Philipp A2017-02-221-2/+5
| |
* | DOC: Added more common example for np.c_Philipp A2017-02-221-0/+4
|/ | | | I mostly use that object to bind 1D arrays as columns, so I added an example for that use case.
* Merge pull request #8633 from MSeifert04/boolean_arrays_in_ix__funcEric Wieser2017-02-191-1/+14
|\ | | | | DOC: Mention boolean arrays in the ix_ documentation.
| * DOC: Mention boolean arrays in the ix_ documentation.Michael Seifert2017-02-181-1/+14
| |
* | DOC: Fix typo in fill_diagonal docstring.Antony Lee2017-02-181-2/+2
|/
* MAINT: Remove __setslice__ and __getslice__Eric Wieser2017-02-091-7/+0
| | | | | This code was only here for Python 2.5 compatibility, but numpy requires 2.7 at minimum
* DOC: Use print only as function when print_function is imported from __future__gfyoung2015-12-191-2/+2
| | | | Closes gh-6863.
* DOC: typo: affectLars Buitinck2015-10-021-1/+1
|
* BUG: made view of new array to fix ix_ bugmlai2015-07-111-1/+1
| | | | | | closes gh-6062 done with help of Sebastian Berg! =)
* DOC, MAINT: fix typo in np.fill_diagonal docstring exampleFrançois Magimel2015-06-241-3/+5
|
* Merge pull request #5605 from shoyer/stackCharles Harris2015-05-121-1/+1
|\ | | | | ENH: add np.stack
| * ENH: add np.stackStephan Hoyer2015-05-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | BUG: Fix handling of non-empty ndarraysJaime Fernandez2015-05-041-3/+5
| |
* | BUG: make empty inputs to ix_ create an empty int typed outputJaime Fernandez2015-04-271-9/+7
| | | | | | | | Fixes #5804
* | DOC: Reconcile docstrings and function signatures where they disagreeRobert McGibbon2015-03-021-1/+1
|/ | | | | Fixed typos in docstrings were updated for functions where the parameter names in the docstring didn't match the function signature.
* MAINT: merge _compiled_base module into multiarrayJulian Taylor2015-01-221-1/+1
| | | | Allows access to internal functions for the file.
* Correct the fill_diagonal exampleshpaulj2014-08-211-2/+5
|
* STY: Make files in numpy/lib PEP8 compliant.Charles Harris2014-07-311-30/+50
| | | | The rules enforced are the same as those used for scipy.
* BUG: Fix 0-sized ndindexSebastian Berg2013-09-091-1/+2
| | | | | | | The zerosize_ok flag to nditer was missing, so that it did not allow for 0-sized iteration. Closes gh-3714
* STY: Giant comma spacing fixup.Charles Harris2013-08-181-16/+16
| | | | | | | 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: Giant whitespace cleanup.Charles Harris2013-08-181-1/+1
| | | | Now is as good a time as any with open PR's at a low.
* MAINT: adept divisions for truedivideSebastian Berg2013-05-311-1/+1
| | | | Following deprecations would cause problems otherwise.
* MAINT: Apply 2to3 idioms fixer.Charles Harris2013-05-021-3/+3
| | | | | | | | | | | | | | | | | | | 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 next fixer.Charles Harris2013-04-151-7/+12
| | | | | | | | | | | | | | The next builtin has been available since Python 2.6 and allows `it.next()` to be replaced by `next(it)`. In Python 3 the `next` method is gone entirely, replaced entirely by the `__next__` method. The next fixer changes all the `it.next()` calls to the new form and renames the `next` methods to `__next__`. In order to keep Numpy code backwards compatible with Python 2, a `next` method was readded to all the Numpy iterators after the fixer was run so they all contain both methods. The presence of the appropriate method could have been made version dependent, but that looked unduly complicated. Closes #3072.
* 2to3: Apply `map` fixer.Charles Harris2013-04-101-2/+2
| | | | | | | | | | | | | | | | | | | 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-1/+2
|\ | | | | DOC: Formatting fixes using regex
| * DOC: Used regex to find colons missing spaces which render wrong online, ↵endolith2013-03-191-1/+2
| | | | | | | | also other spacing or formatting mistakes
* | Merge pull request #3178 from charris/2to3-apply-import-fixernjsmith2013-04-021-3/+3
|\ \ | | | | | | 2to3 apply import fixer
| * | 2to3: Use absolute imports.Charles Harris2013-03-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge pull request #3104 from seberg/nditer-allow-0dCharles Harris2013-04-011-24/+1
|\ \ \ | |/ / |/| | Make AdvancedNew iter more 0-d aware
| * | MAINT: Remove np.ndindex 0-d hack.Sebastian Berg2013-03-031-24/+1
| |/
* | 2to3: Replace xrange by range and use list(range(...)) where neededCharles Harris2013-03-271-1/+1
|/ | | | | | | | | | | | | | | 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.
* Fix-up logic for checking for zero-d arrays.Travis E. Oliphant2013-01-211-1/+3
|
* Fix 0-d ndincr to have correct return value.Travis E. Oliphant2013-01-111-1/+1
|
* Fix the test for numpy.ndindex()Travis E. Oliphant2013-01-111-5/+18
| | | | | Fix ndindex for 0-d arrays. Add tests for tuple arguments to ndindex
* Use super instead of direct access to inheritance.Travis E. Oliphant2013-01-101-1/+1
|
* Fix the 0-d patch so it doesn't change the non 0-d iteratorTravis E. Oliphant2013-01-101-11/+11
|
* Fix ndindex for 0-d arrays.Travis E. Oliphant2013-01-101-1/+10
|
* Retain backward compatibility. Enforce C order.Stefan van der Walt2012-09-021-1/+9
|