summaryrefslogtreecommitdiff
path: root/numpy/lib/arraysetops.py
Commit message (Collapse)AuthorAgeFilesLines
* 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
| |
* | Add examples for intersect1d and union1d of more than two arrays.Christian Brueffer2014-10-151-0/+10
| | | | | | | | The approach was suggested by Jaime Frio in issue #5179.
* | BUG: np.unique with chararray + inverse_indexCJ Carey2014-09-231-1/+1
| | | | | | | | | | The call to `empty_like` was trying to use the `chararray` subclass, which doesn't support the `np.intp` dtype.
* | DOC: warn about using a set with 'in1d'.Patrick Peglar2014-08-311-0/+4
| |
* | ENH: Speed up `unique` with `return_inverse`jaimefrio2014-08-271-2/+3
|/ | | | This replaces a sort with fancy indexing.
* STY: Make files in numpy/lib PEP8 compliant.Charles Harris2014-07-311-7/+7
| | | | 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-4/+7
| | | | | | 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: Correct behavior for lists of tuples in unique, closes #4785jaimefrio2014-06-061-7/+1
| | | | | | | | np.unique produces wrong results when passed a list of tuples and no keyword arguments, as it fails to recognize it as a multidim array, but handles it as a 1D array of objects. The only way around this seems to be to completely eliminate the fast path for non-array inputs using `set`.
* ENH: add a 'return_counts=' keyword argument to `np.unique`jaimefrio2014-04-051-26/+42
| | | | | | | | | | | | | | | | This PR adds a new keyword argument to `np.unique` that returns the number of times each unique item comes up in the array. This allows replacing a typical numpy construct: unq, _ = np.unique(a, return_inverse=True) unq_counts = np.bincount(_) with a single line of code: unq, unq_counts = np.unique(a, return_counts=True) As a plus, it runs faster, because it does not need the extra operations required to produce `unique_inverse`.
* BUG: Fixes #2799jaimefrio2014-02-211-2/+1
| | | | | Use `np.sort` instead of `sorted` when the input is a list and no indices are requested. Fixes #2799.