Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def calculate_CS(weight,height,wc,hc,sex,age):
- aList = []
- df_flask = pd.DataFrame([[weight,height,wc,hc,sex,age]],columns=['weight','height','wc','hc','sex','age'])
- for i,row in df.iterrows():
- result = cosine_similarity(df1.iloc[[i]],df_flask.iloc[[0]])[0][0]
- aList.append([i,result])
- aList = sorted(aList,key=lambda l:l[1], reverse=True)
- return aList[0:5]
- #return aList[0]
- def get_data(n):
- id = df.iloc[n]['person_id']
- return treatments['value_text'][(treatments['person_id'] == id)]
- list_treatments = []
- for row in res:
- print get_data(row[0])
- list_treatments.append(get_data(row[0]))
Add Comment
Please, Sign In to add comment