We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://numpy.org/doc/stable/reference/generated/numpy.unique.html
The text was updated successfully, but these errors were encountered:
While it is not the most performant way, I think you can already get this functionality by
a = np.array(...) set(a.tolist())
Sorry, something went wrong.
But set not support ndarray to list result.
set
ndarray
list
a = np.arange(9).reshape((3, 3)) a
array([[0, 1, 2], [3, 4, 5], [6, 7, 8]], dtype=int16)
a = a.tolist() a
[[0, 1, 2], [3, 4, 5], [6, 7, 8]]
set(a)
Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported type for __hash__: 'list'
Only support 1D:
a = np.arange(9) a
array([0, 1, 2, 3, 4, 5, 6, 7, 8], dtype=int16)
{0, 1, 2, 3, 4, 5, 6, 7, 8}
Although we can do set operation after numpy.reshape:
numpy.reshape
a = a.reshape((9, )) set(a) a = a.reshape((3, 3))
But the return_index parameter result will pointless.
return_index
I am trying to understand in what situation this function would be required.
No branches or pull requests
https://numpy.org/doc/stable/reference/generated/numpy.unique.html
The text was updated successfully, but these errors were encountered: