Menu Close

How to find unique rows in a Python numpy.array?

Sometimes, we want to find unique rows in a Python numpy.array.

In this article, we’ll look at how to find unique rows in a Python numpy.array.

How to find unique rows in a Python numpy.array?

To find unique rows in a Python numpy.array, we can use the unique method.

For instance, we write

unique_rows = np.unique(original_array, axis=0)

to call np.unique with the origina_array NumPy array.

We specify that we check for uniques on axis 0.

Conclusion

To find unique rows in a Python numpy.array, we can use the unique method.

Posted in Python, Python Answers