Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to find unique sublist in list in python

In [22]: lst = [[1,2,3],[1,2],[1,2,3],[2,3],[4,5],[2,3],[2,4],[4,2]]

In [23]: set(frozenset(item) for item in lst)
Out[23]: 
set([frozenset([2, 4]),
     frozenset([1, 2]),
     frozenset([2, 3]),
     frozenset([1, 2, 3]),
     frozenset([4, 5])])
Comment

how to find unique sublist in list in python

set(tuple(sorted(i)) for i in lst)
Comment

unique items in a list python

list(dict.fromkeys(list_with_duplicates))
Comment

PREVIOUS NEXT
Code Example
Python :: how to add a new element to a list in python 
Python :: iterating over tuples in python 
Python :: remove all parentheses from string python 
Python :: how to link button to the urls in django 
Python :: how to test value error in pytest in python 
Python :: python string replace letters with numbers 
Python :: qpushbutton clicked 
Python :: python sqlite select column name 
Python :: if key not in dictionary python 
Python :: tkinter python button 
Python :: cosine similarity python 
Python :: count values python 
Python :: python count of values in array 
Python :: python readlines strip 
Python :: add data to empty column pandas 
Python :: Python Tkinter TopLevel Widget 
Python :: how to convert categorical data to numerical data in python 
Python :: python function parameters default value 
Python :: cv2.videocapture python set frame rate 
Python :: if start and end point is same in range function python 
Python :: _getexif 
Python :: pop function in python 
Python :: webdriver python get total number of tabs 
Python :: series floor 
Python :: pandas join two dataframes 
Python :: STATPC 
Python :: seaborn boxplot change filling 
Python :: difference between local and global variable in python 
Python :: how to calculate numbers with two zeros in python 
Python :: convert numpy array to tfrecord and back 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =