Issue: Value can append. Buut the entire row cannot append. Please help
family =[
["Relation", "Name", "Age", "Location"],
["Father", "AliBaba", "69", "UK"],
["Mother", "AliMama", "96", "US"],
["Son", "AliSon", "10", "Canada"],
["Son", "AliSon2", "12", "Mexico"]
]
duplicate_value = []
unique_value = []
for row in family:
value = row[0] # refering to "Relatonship"
if value in unique_value:
duplicate_value.append(value)
else:
unique_value.append(value)
duplicate_value
# correctly shows that there are enttries for the "Son"
['Son']
But when I do the same to append the entire row, I am unable to do it.
duplicate_row = []
unique_row = []
for row in family:
value = row[0] # refering to "Relatonship"
if value in unique_row:
duplicate_row.append(row) # appending row instead of the data point
else:
unique_row.append(row)
duplicate_row
[]