代码语言:javascript复制
input_list = [1,1,2,2,3,3,4,5,6,7,33,2,4,6,7,4,2]
def functionList1(data):
return list(set(data))
def functionList2(data):
new_data = []
for i in range(len(data)):
if data[i] not in new_data:
new_data.append(data[i])
return new_data
def functionList3(data):
return [i for n, i in enumerate(data) if i not in data[:n]]
def functionList4(data):
print(dict.fromkeys(data))
return list(dict.fromkeys(data))
def functionList5(data):
import pandas as pd
return pd.unique(data).tolist()
print(functionList1(input_list))
print(functionList2(input_list))
print(functionList3(input_list))
print(functionList4(input_list))
print(functionList5(input_list))