Spaces:
Sleeping
Sleeping
| def check_spark(row, col_name='name', types=['Игристое', 'игр']): | |
| if col_name in row.keys(): | |
| for t in types: | |
| if t.lower() in row[col_name].lower() and 'Пилигрим' not in row[col_name].lower(): | |
| return 'Игристое' | |
| return None | |
| def check_color_and_sour(row, col_name='type_wine', types=['Белое', 'Розовое', 'Красное', 'крас.', 'бел.']): | |
| if col_name in row.keys(): | |
| for t in types: | |
| if t.lower() in row[col_name].lower(): | |
| return 'Вино' | |
| return None | |
| def is_type_exist(row, types): | |
| for t in types: | |
| if t.lower() in row['type'].lower(): # Сравнение без учета регистра | |
| return t | |
| return None | |
| def check_type(row, types): | |
| #checker=False | |
| for t in types: | |
| if t.lower() in row['name'].lower(): # Сравнение без учета регистра | |
| return t | |
| return None | |
| def get_type(row, types): | |
| if 'type' not in row.keys(): | |
| return check_type(row, types) | |
| elif 'type' in row.keys(): | |
| semi_res=is_type_exist(row, types) | |
| if semi_res!=None: | |
| return semi_res | |
| else: | |
| return check_type(row, types) | |
| return None | |