Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

NumPy unique Example Get the unique rows and columns

# welcome to softhunt.net
import numpy as np

# Creating 2D Array
duplicate_array_2d = np.array([[2,2,1],[4,5,5],[2,5,5]])

print('2D array:
', duplicate_array_2d)

# GET UNIQUE ROWS
unique_rows  = np.unique(duplicate_array_2d, axis = 0)
print('Unique rows: 
', unique_rows)

# GET UNIQUE COLUMNS
unique_columns  = np.unique(duplicate_array_2d, axis = 1)
print('Unique columns: 
', unique_columns)
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #NumPy #unique #Example #Get #unique #rows #columns
ADD COMMENT
Topic
Name
2+1 =