| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
| |
|
| |
|
|
|
|
| |
- Switch dictionary->table, mergesort->sort
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
- Add flag ``_slow_integer`` to np.isin/np.in1d to force the use of the
old isin/in1d algorithm for integers.
|
|
|
|
|
|
| |
- These tests hit the areas of the old algorithm which are now replaced
for the majority of cases
- Another test tests behaviour of boolean input to isin/in1d
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
This PR adjusts np.unique for the edge cases where all values are nan.
Fixes gh-19300
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| |
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
| |
Tweak a few lines so that arrays with an axis with length 0
don't break the np.unique code.
Closes gh-15559.
|
|
|
|
|
| |
This code is from github user huonw, from this PR:
https://github.com/numpy/numpy/pull/15565
|
|
|
|
|
|
|
| |
Inheriting from object was necessary for Python 2 compatibility to use
new-style classes. In Python 3, this is unnecessary as there are no
old-style classes.
Dropping the object is more idiomatic Python.
|
|
|
|
|
| |
As numpy is Python 3 only, these import statements are now unnecessary
and don't alter runtime behavior.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#12448)
* Review F401,F841,F842 flake8 errors (unused variables, imports)
* Review comments
* More tests in test_installed_npymath_ini
* Review comments
|
|
|
|
|
|
|
|
| |
* 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
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
| |
|
|
|
|
|
| |
That function is nose specific and has not worked since `__init__` files
were added to the tests directories.
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
| |
[ci skip]
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Fixes #9137
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
Previously, these had different rules for unmasking values, and even different
arguments to decide how to do so.
Fixes #8664
|
| |
|