summaryrefslogtreecommitdiff
path: root/numpy/lib/twodim_base.py
Commit message (Collapse)AuthorAgeFilesLines
* MAINT: Rename histogramdd's normed argument to density, to match histogramEric Wieser2018-07-081-4/+10
| | | | Fixes gh-4371
* ENH: Disable fuzzing on histogram boundariesEric Wieser2018-04-301-1/+1
| | | | | | | | | | Previously a fuzzy rounded comparison was used for the rightmost bin of histogramdd. It's not clear why this was done, and it resulted in surprising behavior. This also removes the restriction that bin edges must be floats, and allows integer arrays to be passed (and returned) Fixes gh-10864
* ENH: Add `order=` keyword to `np.eye()` (#9996)Danny Hermes2017-11-121-2/+7
| | | Fixes #9995
* MAINT: Don't internally use the one-argument whereEric Wieser2017-06-031-3/+4
| | | | nonzero is a clearer spelling
* DOC: Correct shape of edges in np.histogram2d (#8980)Importance of Being Ernest2017-04-231-2/+2
| | | | | If nx and ny are the bin counts (as stated in the bins argument's text), then the return H has indeed shape (nx, ny). However, the returned xedges and yedges will then have shape (nx+1,) and (ny+1,) respectively. Fixes #8979
* DOC: Improve histogram2d() example.wrwrwr2016-10-081-29/+17
| | | | Closes #8115.
* ENH: generalize rot90 with axes kwarg, move to function_base.py, and add testsDenis Alevi2016-03-201-57/+4
|
* ENH: Add generalized flip function and its testsEren Sezener2016-03-121-4/+4
|
* DOC: fix a number of reST formatting issues in docstrings.Ralf Gommers2016-02-131-2/+2
|
* DOC: Use print only as function when print_function is imported from __future__gfyoung2015-12-191-1/+1
| | | | Closes gh-6863.
* DOC: Updated docstring for histogram2d as suggested in issue #5538Åsmund Hjulstad2015-02-131-3/+5
| | | | Also, added unittest for [int, array] combination arguments
* BUG: Make diag, diagonal return 1-D arrays for matrix arguments.Charles Harris2015-01-041-2/+2
| | | | | | | | This is an ugly hack to preserve backwards compatibility for code that uses matrices. It is needed since both diag and diagonal have been changed to preserve subtypes otherwise. Note that a.diagonal() still returns matrices when a is a matrix.
* Improved PEP-8 complianceGarrett-R2014-12-081-0/+2
|
* BUG: Closes #2015: diag returns ndarrayGarrett-R2014-12-081-1/+1
| | | | | | | If x is a matrix, np.diag(x) and np.diagonal(x) now return matrices instead of arrays. Both of these cause x.diagonal() to be called. That means they return row vectors (just like x.flatten(), x.ravel(), x.cumprod(), etc.)
* Merge pull request #4929 from juliantaylor/charris-pep8-numpy-libCharles Harris2014-07-311-8/+8
|\ | | | | Charris pep8 numpy lib
| * MAINT: Fixes for problems in numpy/lib revealed by pyflakes.Charles Harris2014-07-311-8/+8
| | | | | | | | | | | | 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.
* | BUG: Avoid type promotion in tril and triu.Yotam Doron2014-07-291-2/+2
| |
* | BUG: Use `np.where` in np.triu/np.tril, fixes #4859jaimefrio2014-07-101-3/+6
|/ | | | | Replaces the current method to zero items, from multiplication to using `np.where`.
* STY: Use `.astype`'s `copy` kwarg in `np.tri`jaimefrio2014-05-271-4/+2
| | | | Replace an explicit type check with setting `copy=False` in call to `astype`.
* ENH: Replace exponentiation with cumulative product in np.vanderjaimefrio2014-03-311-25/+27
| | | | | Speeds calculation up by ~3x for 100x100 matrices, and by ~45x for 1000x1000
* ENH: use smallest integer for tri rangesJulian Taylor2014-03-271-2/+17
| | | | reduces buffer copy and comparison overhead for boolean outer product
* ENH: speed-up of triangular matrix functionsjaimefrio2014-03-251-21/+41
| | | | | | | | | | | | | | | * `np.tri` now produces less intermediate arrays. Runs about 40% faster for general dtypes, up to 3x faster for boolean arrays. * `np.tril` now does smarter type conversions (thanks Julian!), and together with the improvements in `np.tri` now runs about 30% faster. `np.triu` runs almost 2x faster than before, but still runs 20% slower than `np.tril`, which is an improvement over the 50% difference before. * `np.triu_indices` and `np.tril_indices` do not call `np.mask_indices`, instead they call `np.where` directly on a boolean array created with `np.tri`. They now run roughly 2x faster. * Removed the constraint for the array to be square in calls to `np.triu_indices`, `np.tril_indices`, `np.triu_indices_from` and `np.tril_indices_from`.
* DOC: Fix documentation of normed in histogram2d and histogramdd.Charles Harris2014-02-261-21/+18
| | | | | | | | | | The documentation misrepresented what happened, leaving out division by the total number of sample points. Also run spellcheck over function_base.py and twodim_base.py and break some long lines. Closes #2423.
* ENH: tril and triu broadcastingalex2014-02-241-2/+2
|
* Merge pull request #4316 from charris/fix-gh-4092seberg2014-02-181-3/+3
|\ | | | | DOC: Remove \n from strings in plot examples.
| * DOC: Remove \n from strings in plot examples.Charles Harris2014-02-171-3/+3
| | | | | | | | | | | | | | | | The \n occur in plot titles and mess up the generated html. An alternative fix would be to use a raw docstring or \\n, but here it looks simpler to just delete the problem. Closes #4092.
* | DOC: Document that fliplr only works on 2-D arrays.Charles Harris2014-02-161-3/+2
|/ | | | | | Docstring claimed 2-D was not required, but it is. Fix that. Closes #3332.
* Fix typo.Markus Roth2013-11-151-1/+1
|
* DOC: Spelling correction for numpy.diag see alsoChris Kerr2013-11-111-1/+1
|
* MAINT: lib: Use a consistent PEP8-compliant import style in twodim_base.py ↵Warren Weckesser2013-11-021-2/+4
| | | | and tests/test_twodim_base.py. Also make a couple more PEP8 tweaks.
* MAINT: lib: Add a 'See Also' section to the vander docstring, and make a few ↵Warren Weckesser2013-11-021-3/+7
| | | | more PEP8 tweaks.
* MAINT: lib: remove unused imports and PEP8 clean up in twodim_base.pyWarren Weckesser2013-11-021-7/+18
|
* ENH: lib: Rewrite vander: make it faster, and add an option to specify the ↵Warren Weckesser2013-11-021-14/+34
| | | | order of the powers (either decreasing or increasing).
* STY: Giant comma spacing fixup.Charles Harris2013-08-181-17/+17
| | | | | | | 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.
* DOC: fix some minor issues with histogram2d docstring formatting.Ralf Gommers2013-08-111-9/+19
|
* DOC: update example of histogram2d to doctest format.Frank Breitling2013-08-111-31/+30
|
* Merge pull request #3531 from fkbreitl/masternjsmith2013-07-181-15/+45
|\ | | | | Updated documentation for histogram2d() in twodim_base.py according to discussion
| * Update twodim_base.pyFrank Breitling2013-07-171-1/+1
| |
| * Update twodim_base.pyFrank Breitling2013-07-131-33/+44
| |
| * Fixed two typos.Frank B2013-02-051-2/+2
| |
| * Added example for 2D-histogram with variable bin size.Frank B2013-02-051-2/+21
| |
* | 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.
* | 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: Put `from __future__ import division in every python file.Charles Harris2013-03-011-0/+1
|/ | | | | | | | 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: Further tweaks to histogram2d docstring.Stefan van der Walt2012-11-261-9/+11
|
* Remove maskna API from ndarray, and all (and only) the code supporting itNathaniel J. Smith2012-06-161-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original masked-NA-NEP branch contained a large number of changes in addition to the core NA support. For example: - ufunc.__call__ support for where= argument - nditer support for arbitrary masks (in support of where=) - ufunc.reduce support for simultaneous reduction over multiple axes - a new "array assignment API" - ndarray.diagonal() returning a view in all cases - bug-fixes in __array_priority__ handling - datetime test changes etc. There's no consensus yet on what should be done with the maskna-related part of this branch, but the rest is generally useful and uncontroversial, so the goal of this branch is to identify exactly which code changes are involved in maskna support. The basic strategy used to create this patch was: - Remove the new masking-related fields from ndarray, so no arrays are masked - Go through and remove all the code that this makes dead/inaccessible/irrelevant, in a largely mechanical fashion. So for example, if I saw 'if (PyArray_HASMASK(a)) { ... }' then that whole block was obviously just dead code if no arrays have masks, and I removed it. Likewise for function arguments like skipna that are useless if there aren't any NAs to skip. This changed the signature of a number of functions that were newly exposed in the numpy public API. I've removed all such functions from the public API, since releasing them with the NA-less signature in 1.7 would create pointless compatibility hassles later if and when we add back the NA-related functionality. Most such functions are removed by this commit; the exception is PyArray_ReduceWrapper, which requires more extensive surgery, and will be handled in followup commits. I also removed the new ndarray.setasflat method. Reason: a comment noted that the only reason this was added was to allow easier testing of one branch of PyArray_CopyAsFlat. That branch is now the main branch, so that isn't an issue. Nonetheless this function is arguably useful, so perhaps it should have remained, but I judged that since numpy's API is already hairier than we would like, it's not a good idea to add extra hair "just in case". (Also AFAICT the test for this method in test_maskna was actually incorrect, as noted here: https://github.com/njsmith/numpyNEP/blob/master/numpyNEP.py so I'm not confident that it ever worked in master, though I haven't had a chance to follow-up on this.) I also removed numpy.count_reduce_items, since without skipna it became trivial. I believe that these are the only exceptions to the "remove dead code" strategy.
* Document the PyArray_Diagonal transition scheme.Nathaniel J. Smith2012-05-161-2/+5
|
* Transition scheme for allowing PyArray_Diagonal to return a viewNathaniel J. Smith2012-05-161-1/+7
| | | | | | | | | | | | | | | | PyArray_Diagonal is changed to return a copy of the diagonal (as in numpy 1.6 and earlier), but with a new (hidden) WARN_ON_WRITE flag set. Writes to this array (or views thereof) will continue to work as normal, but the first write will trigger a DeprecationWarning. We also issue this warning if someone extracts a non-numpy writeable view of the array (e.g., by accessing the Python-level .data attribute). There are likely still places where the data buffer is exposed that I've missed -- review welcome! New known-fail test: eye() for maskna arrays was only implemented by exploiting ndarray.diagonal's view-ness, so it is now unimplemented again, and the corresponding test is marked known-fail.
* DOC: merge wiki doc edits.Ralf Gommers2012-03-031-9/+14
|
* FIX: Make tril/triu return the same dtype as the original array.Fabian Pedregosa2011-08-311-2/+2
| | | | | | | This should fix: * http://projects.scipy.org/numpy/ticket/1848 * http://projects.scipy.org/scipy/ticket/1449