'need to remove a row from a 2D array in python if one element is a duplicate (w/o numpy)

if I had a 2d array

`profileData = [['21','34,'12']['19','34','6']['21','2','12']['16','9','4']['19','11','21']]`

I need to be able to remove any duplicates of the first element within each row. So the array would now look like

profileData = [['21','34,'1]['19','34','6']['16','9','4']]


Solution 1:[1]

profileData = [['21','34','12'],['19','34','6'],['21','2','12'],['16','9','4'],['19','11','21']]
output = []
for rowData in profileData:
    exist = False 
    for rowOutput in output:
        if rowData[0] == rowOutput[0]:
            exist = True
    if not exist:
        output.append(rowData)

print(output)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Doni