Advertisement
bard356

Untitled

Feb 28th, 2020
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.76 KB | None | 0 0
  1. #print(data_customer['purpose'].unique())
  2. from pymystem3 import Mystem
  3. m = Mystem()
  4. list_purpose = data_customer['purpose'].unique()
  5. list_lemm = []
  6. def purpose_group(lemma):
  7.     for i in list_purpose:
  8.     lemma = m.lemmatize(i)
  9.         if lemma == 'жилье' or 'недвижимость':
  10.             return 'операции с недвижимостью'
  11.         if lemma == 'свадьба':
  12.             return 'свадьба'
  13.         if lemma == 'автомобиль':
  14.             return 'приобретение автомобиля'
  15.         else:
  16.             return 'образование'
  17.         list_lemm.append(lemma)          
  18. #data_customer['purpose'] = data_customer['purpose'].apply(purpose_group)
  19. print(data_customer['purpose'].unique())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement