Guest User

Untitled

a guest
Mar 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. def calculate_CS(weight,height,wc,hc,sex,age):
  2. aList = []
  3. df_flask = pd.DataFrame([[weight,height,wc,hc,sex,age]],columns=['weight','height','wc','hc','sex','age'])
  4. for i,row in df.iterrows():
  5. result = cosine_similarity(df1.iloc[[i]],df_flask.iloc[[0]])[0][0]
  6. aList.append([i,result])
  7. aList = sorted(aList,key=lambda l:l[1], reverse=True)
  8. return aList[0:5]
  9. #return aList[0]
  10.  
  11. def get_data(n):
  12. id = df.iloc[n]['person_id']
  13. return treatments['value_text'][(treatments['person_id'] == id)]
  14.  
  15. list_treatments = []
  16. for row in res:
  17. print get_data(row[0])
  18. list_treatments.append(get_data(row[0]))
Add Comment
Please, Sign In to add comment