smer_prods - это словарь, который выглядит следующим образом:
smer_prods = {
#'vermicelli' : ['vermicelli', 'ragi vermicelli', 'rice vermicelli'],
'ragi vermicelli' : ['ragi vermicelli'],
'rice vermicelli' : ['rice vermicelli'],
'vermicelli jupiter' : ['vermicelli jupiter'],
'lemon & tamarind vermicelli' : ['lemon & tamarind vermicelli'],
'finosta vermicelli' : ['finosta vermicelli-5kg'],
'rosted vermicelli' : ['roasted vermicelli'],
'semiya/vermicelli' : ['semiya / vermicelli 900grams'],
'vermicelli upma' : ['vermicelli upma'],
'vermicelli payasam mix' : ['vermicelli payasam mix'],
'mung bean vermicelli' : ['mung bean vermicelli'],
'red chili' : ['red chilli (lal mirch)','guntur red chilli','red chilly whole(lal mirch)', 'red chilly wg', 'red chilli whole (hot) 1 kg', 'red chilli whole (rich colour) 1 kg'],
'red chili powder' : ['red chilli fresh-kg','red chilli powder (rich colour) 1 kg','red chilli powder (hot) 1 kg','red chilli powder','lal mirch powder','lal mirch powder 100gms', 'lal mirch powder 1kg', 'lal mirch powder 200gms', 'lal mirch powder 500gms'],
'red chilli sauce' : ['red chilli sauce', 'red chilli sauce 200gm pet bottle 48X200gm', 'hot chili sauce'],
'sriraja hot chilli sauce' : ['sriraja hot chilli sauce', 'sriracha hot chilli sauce'],
'mineral water' : ['himalayan orchard pure peach flavoured natural mineral water - 500 ml','himalayan orchard pure strawberry flavoured natural mineral water - 500 ml','himalayan orchard pure apple flavoured natural mineral water - 500 ml','himalayan - the natural mineral water - 500ml bottle', 'himalayan - the natural mineral water - 200ml bottle', 'himalayan - the natural mineral water - 1ltr bottle'],
}
CSV для фрейма данных df выглядит так: 
Теперь, когда я выполняю это простоекод:
for x in smer_prods:
mask = df['ITEM NAME'] == x
df1 = df[mask]
print(df1['ITEM NAME'])
Он должен печатать только столбец ITEM_NAME, но выводит много лишней дополнительной информации:
4 rice vermicelli
Name: ITEM NAME, dtype: object
Series([], Name: ITEM NAME, dtype: object)
Series([], Name: ITEM NAME, dtype: object)
5 ragi vermicelli
Name: ITEM NAME, dtype: object
Series([], Name: ITEM NAME, dtype: object)
Series([], Name: ITEM NAME, dtype: object)
Series([], Name: ITEM NAME, dtype: object)
Series([], Name: ITEM NAME, dtype: object)
Series([], Name: ITEM NAME, dtype: object)
Series([], Name: ITEM NAME, dtype: object)
Series([], Name: ITEM NAME, dtype: object)
Series([], Name: ITEM NAME, dtype: object)
1 sriraja hot chilli sauce
Name: ITEM NAME, dtype: object
Series([], Name: ITEM NAME, dtype: object)
Series([], Name: ITEM NAME, dtype: object)
Я хочу, чтобы в списке были только совпадающие элементы.Для которого я написал код:
for x in smer_prods:
mask = df['ITEM NAME'] == x
df1 = df[mask]
item_name = df1['ITEM NAME'].tolist()
print(item_name)
Он дал такой вывод: ['Rice Vermicelli']
[]
[]
['ragi vermicelli']
[]
[]
[]
[]
[]
[]
[]
[]
['sriraja hot chilli sauce']
[]
[]
Желаемый вывод:
['rice vermicelli', 'ragi vermicelli', 'sriraja hot chili sauce']
Изменить: Если я напишу это:
match = []
for x in smer_prods:
mask = df['ITEM NAME'] == x
if mask.any() == True:
df1 = df[mask]
item_name = df1['ITEM NAME']#note
match.append(item_name)
print(match)
print('-'*80)
Это выводит:
[4 rice vermicelli
Name: ITEM NAME, dtype: object, 5 ragi vermicelli
Name: ITEM NAME, dtype: object, 1 sriraja hot chilli sauce
Name: ITEM NAME, dtype: object]