Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

remove duplicates without changing order python

sequence = ['1', '2', '3', '3', '6', '4', '5', '6']
unique = []
[unique.append(item) for item in sequence if item not in unique]
Comment

python list remove duplicates keep order

import pandas as pd

my_list = [0, 1, 2, 3, 4, 1, 2, 3, 5]

>>> pd.Series(my_list).drop_duplicates().tolist()
# Output:
# [0, 1, 2, 3, 4, 5]
Comment

PREVIOUS NEXT
Code Example
Python :: python namedtuple 
Python :: python yaml parser 
Python :: python get financial data 
Python :: count plot 
Python :: jupyter notebook check memory usage 
Python :: oppsite of abs() python 
Python :: replace multiple spaces with single space python 
Python :: remove jupyter environment 
Python :: reset index 
Python :: char list 
Python :: pandas open text file 
Python :: mean code python 
Python :: create jwt token python 
Python :: python print exception 
Python :: python legend outside 
Python :: boston dataset sklearn 
Python :: python ndarray string array into int 
Python :: python how to set multiple conditional for single var 
Python :: python reduce function to sum array 
Python :: image in tkinter 
Python :: launch google chrome using python 
Python :: json load python 
Python :: capitalize first letter in python 
Python :: ec2 upgrade python 3.7 to 3.8 
Python :: sqrt python 
Python :: python temporaty files 
Python :: lda scikit learn 
Python :: minute range python 
Python :: pil overlay images 
Python :: align columns to left pandas python 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =