While working with Python Matrix, we can face a problem in which we need to perform the removal of duplicates from Matrix. This problem can occur in Machine Learning domain because of extensive usage of matrices. Let’s discuss certain way in which this task can be performed.
Method : Using loop
This task can be performed in brute force manner using loops. In this, we just iterate the list of list using loop and check for the already presence of element, and append in case it’s new element, and construct a non-duplicate matrix.
The original list is : [[5, 6, 8], [8, 5, 3], [9, 10, 3]] The Matrix after duplicates removal is : [[5, 6, 8], , [9, 10]]
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.