import pandas as pd
import re
excel = pd.read_excel('data.xlsx', index_col=None, usecols='A, C').to_dict()
pattern = re.compile('Автобус')
who_proposed_commisions = excel['Транспорт']
comissions_number = excel['номер']
commisions = list(zip(who_proposed_commisions.values(), comissions_number.values()))
wick_successfully = []
wick_not_successfylly = []
for commision, comission_number in commisions:
if not pattern.search(commision):
wick_successfully.append(comission_number)
else:
wick_not_successfylly.append(comission_number)
wick_successfully = filter(lambda x: x not in wick_not_successfylly, wick_successfully)
print(list(wick_successfully))
[2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034]
woduplicates = list(set(wick_successfully))
print(woduplicates)
wick_successfully = filter(lambda x: x not in wick_not_successfylly, wick_successfully)
print(list(wick_successfully))
woduplicates = list(set(wick_successfully))
print(woduplicates)
print(list(wick_successfully))
итератор wick_successfully уже пуст, поэтому последующие его вызовы и возвращают пустой список.wick_successfully = list(filter(lambda x: x not in wick_not_successfylly, wick_successfully))
wick_successfully = [x for x in wick_successfully if x not in wick_not_successfylly]
print(list(wick_successfully))
woduplicates = list(set(wick_successfully))
print(woduplicates)
woduplicates = list(set(list(wick_successfully)))
print(woduplicates)