summaryrefslogtreecommitdiff
path: root/numpy/lib/arraysetops.py
Commit message (Collapse)AuthorAgeFilesLines
...
* DOC: Improve intersect1d docstring (#16420)Dima Kogan2020-08-051-1/+3
| | | | | | The docstring now says what to expect if you call intersect1d(assume_unique=True) but pass in non-unique data. Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* DOC: add example to unique() and make connection to repeat() (#16743)Allen Downey2020-07-071-1/+13
| | | I suggest adding `repeat` to the "See also" section of `unique` (and vice versa) since each is the inverse of the other.
* BUG: lib: Handle axes with length 0 in np.unique.Warren Weckesser2020-03-151-4/+16
| | | | | | | Tweak a few lines so that arrays with an axis with length 0 don't break the np.unique code. Closes gh-15559.
* Update unique docstring exampleJon Morris2020-02-041-2/+2
|
* MAINT: Remove unnecessary 'from __future__ import ...' statementsJon Dufresne2020-01-031-2/+0
| | | | | As numpy is Python 3 only, these import statements are now unnecessary and don't alter runtime behavior.
* BUG: Make ``ediff1d`` kwarg casting consistentSebastian Berg2019-11-251-13/+13
| | | | | | | | | | | | | | This reverts commit c088383cb290ca064d456e89d79177a0e234cb8d and uses the same kind casting rule for the additional keyword arguments ``to_end`` and ``to_begin``. This results in slightly more leniant behaviour for integers (which can now have overflows that are hidden), but fixes an issue with the handling of NaN. Generally, this behaviour seems more conistent with what NumPy does elsewhere. The Overflow issue exists similar in many other places and should be solved by integer overflow warning machinery while the actual cast takes place. Closes gh-13103
* MAINT: revert gh-14800, which gave precedence to OO->O over OO->?mattip2019-11-061-6/+2
|
* ENH: add OO->? loops, use np.compare(a, b, dtype=bool), add commentsmattip2019-10-301-0/+4
|
* WIP, DEP, ENH: finish richcompare changes from 1.10mattip2019-10-291-2/+2
|
* add description in docstringHuang, Guangtai2019-08-211-0/+1
|
* fix uniqueHuang, Guangtai2019-08-131-2/+2
|
* Add blank line above doctest for intersect1dJackie Leng2019-07-231-0/+1
|
* BUG: loosen kwargs requirements in ediff1dmattip2019-01-101-14/+12
|
* TST, DOC: enable refguide_checkTyler Reddy2018-12-141-14/+12
| | | | | | | | * ported the refguide_check module from SciPy for usage in NumPy docstring execution/ verification; added the refguide_check run to Azure Mac OS CI * adjusted NumPy docstrings such that refguide_check passes
* ENH: set correct __module__ for objects in numpy's public APIStephan Hoyer2018-11-131-0/+5
| | | | | | | | | | | | | Fixes GH-12271 Tests verify that everything in ``dir(numpy)`` either has ``__module__`` set to ``'numpy'``, or appears in an explicit whitelist of undocumented functions and exported bulitins. These should eventually be documented or removed. I also identified a handful of functions for which I had accidentally not setup dispatch for with ``__array_function__`` before, because they were listed under "ndarray methods" in ``_add_newdocs.py``. I guess that should be a lesson in trusting code comments :).
* MAINT: set preferred __module__ for numpy functionsStephan Hoyer2018-10-231-1/+7
|
* DOC, TST: test setdiff1d assume_uniqueTyler Reddy2018-10-161-2/+4
| | | | | | | | * add unit test for setdiff1d covering code path where assume_unique is True * remove setdiff1d docstring guarantee that returned value is sorted -- it is not
* ENH: __array_function__ for np.lib, part 1Stephan Hoyer2018-10-081-0/+39
| | | | np.lib.arraypad through np.lib.nanfunctions
* BUG: add type cast check to ediff1dTyler Reddy2018-08-261-2/+17
|
* BUG: Fix regression in intersect1d.Charles Harris2018-08-171-10/+14
| | | | | | | | | The function was failing for non-ndarray objects that defined that defined __array__, in particular `xarray.DataArray`. Fix by calling asanyarray on the inputs, which was done implicitly before. Closes #11772.
* DOC: Clear up confusion between np.where(cond) and np.where(cond, x, y)Eric Wieser2018-06-291-0/+8
| | | | | | | | Eliminates all mentions of `np.where(cond)`, instead pointing the reader to np.nonzero. Also changes some example numbers to avoid collisions, making them easier to follow. Some minor doc improvements for np.ma.where too.
* ENH: Modify intersect1d to return common indices (#10684)Christopher2018-05-251-8/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * added function commonpts1d * Update arraysetops.py * Update arraysetops.py * modified intersect1d to return common indices Proposed this idea in previous pull request (https://github.com/numpy/numpy/pull/10683) and made suggested changes for implementing this idea to have relevant common indices that correspond to the values in the intersection of the two arrays. * update intersect1d with suggested changes * implemented return_indices options for intersect1d I've tested out the above code and for the ~10 different test sets I've tried it's worked thus far. It's probably not the cleanest implementation but it works and is vectorized. * cleaned up structure for intersect1d * fixed copy-paste error, added second test, changed a conditional * Testing return_indices in intersect1d * formatting * created separate test function for intersect1d indices, added spaces after commas * fixed up example and some style * fixed style * style change * removed one example * removed extra space * added version number for return_indices * added 'return_indices' keyword for np.intersect1d * fixed formatting * updated return_indices entry * fixed some typos and style * added bit about first instance of a value being used * STY: Fix comment formats * DOC: missing space * DOC: correct parameter names in docstring * made suggested changes * fixed a mistake from previous update also added documentation for comm1, comm2 to match doc from np.unique * added in tests for 2d inputs * STY: Add missing spaces around commas * TST: Correct array to actually be unique * STY: Spaces at beginning of comments
* BUG: Revert sort optimization in np.unique.Charles Harris2018-02-141-17/+20
| | | | | | | | The optimization was to sort integer subarrays by treating them as strings of unsigned bytes. That worked fine for finding the unique subarrays, but the sort order of the results could be unexpected. Closes #10495.
* MAINT: Use AxisError in swapaxesEric Wieser2018-02-031-3/+5
|
* MAINT: Make it clear that counts and inverse depend only on the maskEric Wieser2018-01-311-2/+2
|
* DOC: Use a bulleted list to show the outputs of `unique`, for clarityEric Wieser2018-01-311-4/+5
|
* MAINT: Remove special-casing of empty arrays in unique_1dEric Wieser2018-01-311-16/+8
|
* MAINT: Remove messy handling of output tuple in np.uniqueClaudio Freire2018-01-311-31/+33
| | | | Largely taken from gh-9531
* Merge pull request #10342 from anaskhan96/union1d-fixCharles Harris2018-01-181-1/+1
|\ | | | | BUG: arrays not being flattened in `union1d`
| * BUG: concatenation using axis=None in union1dAnas Khan2018-01-091-1/+1
| |
| * BUG: fixing flattening of arrays in `union1d` in arraysetops.pyAnas Khan2018-01-081-1/+1
| |
* | DOC: Fix version added labels in numpy.uniqueSamuel Jackson2018-01-171-0/+4
|/
* Merge pull request #10021 from eric-wieser/no-dtype-bool-reprAllan Haldane2017-11-181-6/+6
|\ | | | | ENH: Don't show the boolean dtype in array_repr
| * ENH: don't show boolean dtype, as it is impliedEric Wieser2017-11-131-6/+6
| |
* | ENH: Make `np.in1d()` work for unorderable object arrays (#9999)Jörg Döpfert2017-11-181-2/+8
|/
* MAINT/DOC: Use builtin when np.{x} is builtins.{x}.Eric Wieser2017-08-051-2/+2
| | | | | | | 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
* MAINT: Make `setxor1d' a bit clearer and speed it upwufangjie2017-07-281-5/+1
|
* make `setxor1d' a bit clear and speed upwufangjie2017-07-271-2/+3
| | | We need to find the index which is not the same with the left and right, I think np.logical_and's meaning is more clear and I test this got a speed up
* BUG: set default type for empty index array to `numpy.intp` (#9142)Konrad Kapp2017-05-201-2/+2
| | | | Fixes #9137
* DOC: fix docstring for np.isinStephan Hoyer2017-05-071-0/+1
|
* ENH: Add isin, genereralizing in1d to ND arrays (#8423)B R S Recht2017-05-051-3/+99
| | | | | | This fixes gh-8331 Also update the docs for arraysetops to remove the outdated "1D" from the description, which was already incorrect for np.unique.
* Added axis argument to numpy.uniquemartinosorb2016-11-131-11/+73
|
* BUG: return subclasses from ediff1dMattHarrigan2016-10-271-13/+12
|
* ENH: fast track default kwargs for ediff1dMattHarrigan2016-10-261-0/+4
| | | | | | Special case to_begin and to_end both equal to None, avoiding subsequent steps. Particulary faster for small arrays where overhead plays a big role.
* ENH: performance improvement to ediff1dMattHarrigan2016-10-181-14/+27
| | | | | Eliminate a copy operation when to_begin or to_end is given. Also use ravel instead of flatiter which is much faster.
* DOC: Fix docstring warnings in documetation generation.Charles Harris2015-07-011-2/+4
| | | | | | | | | | | | Most of these fixes involve putting blank lines around .. versionadded:: x.x.x and .. deprecated:: x.x.x Some of the examples were also fixed.
* BUG: setdiff1d return dtypeChristian Brodbeck2015-05-071-6/+4
| | | | | Fixes #5846 (If called with an empty array as first argument, the returned array had dtype bool instead of the dtype of the input array)
* Merge pull request #5619 from jaimefrio/unique_docstringJulian Taylor2015-03-011-3/+4
|\ | | | | | | DOC: Describe return_counts keyword in np.unique docstring
| * DOC: Describe return_counts keyword in np.unique docstringJaime Fernandez2015-03-011-3/+4
| |
* | ENH: speed-up in1d replacing sorting with fancy indexingjaimefrio2015-01-251-3/+4
| |