Feature request `numpy.unique`
See original GitHub issuePlatform: Ubuntu 16.04 Python version: 3.6 Numba version: 0.37.0
I was trying to get a speedup in my code where I use numpy.unique()
to find unique elements in an n-dimensional array. If I use this:
x = np.unique(arr)
this works fine and returns the expected results. But if I do this:
@jit(nogil=True, nopython=True)
def find_unique(arr):
return np.unique(arr)
x = find_unique(arr)
This throws an error with the following message:
UntypedAttributeError: Failed at nopython (nopython frontend)
Unknown attribute 'unique' of type Module(<module 'numpy' from '/opt/conda/lib/python3.6/site-packages/numpy/__init__.py'>)
File "<ipython-input-15-bd84a508a624>", line 5
[1] During: typing of get attribute at <ipython-input-15-bd84a508a624> (5)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Feature request numpy.unique axis=0 · Issue #7663 - GitHub
Feature request I want to go from a = np.array([[1, 1, 1, 0, 0, 0], [0, 1, 1, 1, 0, 0], ... line...
Read more >numpy.unique — NumPy v1.24 Manual
Returns the sorted unique elements of an array. There are three optional outputs in addition to the unique elements: the indices of the...
Read more >Numpy unique 2D sub-array [duplicate] - Stack Overflow
This is a new feature in the upcoming 1.13, as np.unique(a, axis=0) . You could simply copy the new implementation and use it...
Read more >Find unique values in a numpy array with frequency & indices
In this article we will discuss how to find unique values / rows / columns in a 1D & 2D Numpy array. Also...
Read more >The Ultimate Beginner's Guide to NumPy | by Anne Bonner
Feel free to take a look at the pull request for the absolute ... To get the indices of unique values in a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for the report. You are seeing that message because Numba does not yet support
numpy.unique
. Functions that are supported are listed here. I’m editing the title and making this a feature request. Thanks.I’m not sure how to work with keyword arguments using the highlevel API (I’d have to spend some time on it), but since it’s not going to make it into numba until at least 0.39, here’s code for an overloaded implementation which returns the counts as well.