Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #print(data_customer['purpose'].unique())
- from pymystem3 import Mystem
- m = Mystem()
- list_purpose = data_customer['purpose'].unique()
- list_lemm = []
- def purpose_group(lemma):
- for i in list_purpose:
- lemma = m.lemmatize(i)
- if lemma == 'жилье' or 'недвижимость':
- return 'операции с недвижимостью'
- if lemma == 'свадьба':
- return 'свадьба'
- if lemma == 'автомобиль':
- return 'приобретение автомобиля'
- else:
- return 'образование'
- list_lemm.append(lemma)
- #data_customer['purpose'] = data_customer['purpose'].apply(purpose_group)
- print(data_customer['purpose'].unique())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement