summaryrefslogtreecommitdiff
path: root/numpy/lib/arraysetops.py
Commit message (Collapse)AuthorAgeFilesLines
* BUG: Fix integer overflow in in1d for mixed integer dtypes #22877 (#22878)Miles Cranmer2022-12-251-2/+18
| | | | | | | | | | | | | | | | | | | * TST: Mixed integer types for in1d * BUG: Fix mixed dtype overflows for in1d (#22877) * BUG: Type conversion for integer overflow check * MAINT: Fix linting issues in in1d * MAINT: ar1 overflow check only for non-empty array * MAINT: Expand bounds of overflow check * TST: Fix integer overflow in mixed boolean test * TST: Include test for overflow on mixed dtypes * MAINT: Less conservative overflow checks
* BUG: Fix numpy.isin for timedelta dtype (#21860)Miles Cranmer2022-06-291-10/+10
| | | | | | | | | | | | | | | | | | | | | This PR fixes the issue discussed on #12065 and #21843 where 'timedelta64' was noted to be a subtype of numpy.integer. This in principle should detect any cases where int(np.min(ar2)) fails. This PR also adds unittests for these. * TST: Create in1d test for timedelta input * MAINT: fix in1d for timedelta input * TST: in1d raise ValueError for timedelta input * MAINT: Clean up type checking for isin kind="table" * TST: Add test for mixed boolean/integer in1d * MAINT: Increase readability of in1d type checking * STY: Apply small code style tweaks This is probably really mainly my personal opinion... Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
* BUG: Fix in1d for empty integer array as input (#21842)Miles Cranmer2022-06-241-0/+7
| | | | | | | | | | | * TST: Tests empty input to in1d of various types * MAINT: Skip table method on empty input array * MAINT: Check array size before call to min * MAINT: Return early for kind="table" and empty ar2 * TST: Test other dtypes of empty arrays
* MAINT: Fix edgecase for bool containersMilesCranmer2022-06-221-2/+2
|
* DOC: Rephrase docstring of in1d/isinMilesCranmer2022-06-221-2/+2
|
* MAINT: Remove positionality of kind in isinMilesCranmer2022-06-221-2/+2
|
* MAINT: Minor suggestions from code reviewMiles Cranmer2022-06-221-4/+3
| | | Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
* DOC: Notes on `kind` to in1d/isin docstringMilesCranmer2022-06-201-10/+18
|
* DOC: `assume_unique` does not affect table methodMilesCranmer2022-06-201-4/+8
|
* DOC: Improve clarity of in1d docstringMilesCranmer2022-06-201-6/+6
|
* MAINT: change kind names for in1dMilesCranmer2022-06-181-23/+23
| | | | - Switch dictionary->table, mergesort->sort
* DOC: Fix list format for sphinxMiles Cranmer2022-06-181-9/+11
|
* DOC: Add missing indent in docstringMiles Cranmer2022-06-181-1/+1
|
* DOC: Fix formatting issues in docstringMilesCranmer2022-06-171-4/+2
|
* MAINT: RuntimeError for unexpected integer overflowMilesCranmer2022-06-171-0/+7
|
* MAINT: Clean up integer overflow check in in1dMilesCranmer2022-06-171-11/+5
|
* MAINT: Clean up memory checking for in1dMilesCranmer2022-06-171-11/+9
|
* MAINT: Protect against integer overflow in in1dMilesCranmer2022-06-171-3/+6
|
* MAINT: kind now uses "mergesort" instead of "sort"MilesCranmer2022-06-171-9/+9
|
* MAINT: Switch parameter name to 'kind' over 'method'MilesCranmer2022-06-171-24/+28
|
* MAINT: Switch to old in1d for large memory usageMilesCranmer2022-06-171-13/+18
|
* DOC: Describe memory considerations in in1d/isinMilesCranmer2022-06-101-10/+22
|
* DOC: Clean up isin docstringMilesCranmer2022-06-101-3/+3
|
* MAINT: bool instead of np.bool_ dtypeMilesCranmer2022-06-101-6/+6
|
* DOC: Improve docstring explanationMilesCranmer2022-06-101-2/+2
|
* MAINT: Formatting changes for in1dMiles Cranmer2022-06-101-2/+2
| | | Co-authored-by: Hameer Abbasi <2190658+hameerabbasi@users.noreply.github.com>
* MAINT: Fix error messageMilesCranmer2022-06-101-1/+2
|
* MAINT: Fix use of dispatcher for isinMilesCranmer2022-06-101-2/+2
|
* DOC: Describe default in docstringMilesCranmer2022-06-101-2/+2
|
* DOC: Specify constraints of method in docstringMilesCranmer2022-06-101-2/+4
|
* Add check for methodsMilesCranmer2022-06-101-0/+10
|
* MAINT: Change `_slow_integer` parameter to `method`MilesCranmer2022-06-101-16/+31
|
* MAINT: Fix linting errors in in1d testsMilesCranmer2022-06-091-1/+2
|
* TST: Extend np.in1d tests to old algorithmMilesCranmer2022-06-091-7/+19
| | | | | - Add flag ``_slow_integer`` to np.isin/np.in1d to force the use of the old isin/in1d algorithm for integers.
* MAINT: Check for overflow in integral np.isinMilesCranmer2022-06-091-9/+16
| | | | | | | | | | | - Before this fix, if, e.g., int8(-100) and int8(100) are the min and max, respectively, of ar2, ar2_range would experience an integer overflow and optimal_parameters would be an invalid value. ``if optimal_parameters:`` would skip the fast integer algorithm regardless, but warnings would be generated when they are unnecessary. - np.log10(... + 1) was changed to np.log10(... + 1.0) to avoid further potential problems from overflow here. - See https://github.com/numpy/numpy/pull/12065 for discussion.
* MAINT: Optimize np.isin for boolean arraysMilesCranmer2022-06-091-0/+6
| | | | | - This change converts boolean input to numpy.isin and numpy.in1d into uint8, allowing the function to use the new optimized code
* MAINT: Optimize np.isin for integer arraysMilesCranmer2022-06-091-0/+40
| | | | | | - This optimization indexes with an intermediary boolean array to speed up numpy.isin and numpy.in1d for integer arrays over a range of optimal parameters which are calculated.
* MAINT: Fixup `unique`s `equal_nan` kwarg to match `np.array_equal`Sebastian Berg2022-06-011-11/+11
| | | | | | | | The other similar arguments in the testing functions and `np.array_equal` use `equal_nan` and not `equal_nans` (with plural s). So it seems we should use that here as well for consistency. Does some very minor style fixes otherwise.
* MAINT: Update multiline indentationsJason Thai2022-06-011-1/+1
| | | Co-authored-by: Matti Picus <matti.picus@gmail.com>
* DOC: Update 21623 release documentationJason Thai2022-05-291-1/+1
| | | Co-authored-by: Matti Picus <matti.picus@gmail.com>
* DOC: Added releasenote for 21623Jason Thai2022-05-281-4/+4
|
* ENH: Added equal-nans kwarg to np.uniqueJason Thai2022-05-281-7/+11
|
* DOC: misc fixes:Matthias Bussonnier2022-03-211-1/+1
| | | | | | | | | | - improper urls - a few use of single bakcticks where many are expected - Proper numpydoc format [ci skip] [skip azp] [skip circle]
* BUG: Do not raise deprecation warning for all nans in unique (#19301)Thomas J. Fan2021-06-291-1/+3
| | | | | This PR adjusts np.unique for the edge cases where all values are nan. Fixes gh-19300
* BUG: Fix unique handling of nan entries. (#18070)Filip Trojan2021-02-121-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * benchmark bench_lib.Unique added * extended test_unique_1d * modify _unique1d * extend test with return_index, return_inverse and return_counts parameters * documentation updated * Update numpy/lib/arraysetops.py Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com> * full coverage of nan types Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com> * added tests for the datetime like dtypes * nan as vector of length 1 * use aux[-1] as nan, ..versionchanged, release note * for complex arrays all NaN values are considered equivalent Co-authored-by: filip_trojan <Tarantula2018> Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com>
* Implement different approach to fix bugAngelGris2021-02-081-20/+8
|
* BUG: np.in1d bug on the object array (issue 17923)AngelGris2021-02-081-4/+20
|
* BUG: Fixes incorrect error message in numpy.ediff1d (#17457)stuartarchibald2020-10-051-1/+1
| | | | | | Fixes the error message reported by ediff1d in the case of an invalid to_begin and updates tests to assert validity. Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* DOC: Add arraysetops to autosummary.Ross Barnowski2020-09-291-16/+5
| | | | | | * Generate stub for module, fixes 7 broken links * Modify arraysetops module docstring w/ rst formatting * Remove listing of functions from module docstring.
* MAINT: Chain some exceptions in arraysetops. (#17132)Raghav Khanna2020-08-231-3/+3
| | | | | | | | | | | * MAINT: chain type error line 303 arraysetops.py * MAINT: chain axis error line 281 arraysetops.py * Revert "MAINT: chain axis error line 281 arraysetops.py" This reverts commit f6e1f544bebb7e5346cb83bdac9756be6ee9f4f6. * MAINT: chain axis error line 281 arraysetops.py to be from None