text_plain_output_1.png
from sklearn.metrics.pairwise import cosine_similarity

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

df = pd.read_csv('../input/hackerearth-love-in-the-time-of-screens/data.csv')

df.drop(columns=['user_id', 'username'], inplace=True)

df.shape

lan = []
for i in df['language']:
    l = i.split(',')
    for j in l:
        if j not in lan:
            lan.append(j)

XX = {}
for i in lan:
    l = []
    for j in df['language']:
        if i in j.split(','):
            l.append(1)
        else:
            l.append(0)
    XX[i] = l

df.drop(columns=['language', 'bio'], inplace=True)

df.shape

a = df.dtypes

df.shape

X = df.values

X.shape

ans = []
for i in X:
    l = []
    for j in X:
        l.append(cosine_similarity([i], [j]) * 100)
    ans.append(l)

ans[1][0][0][0]