How to apply cosine_similarity to my dataset?

Viewed 29

I have a dataset:

     0   1   2    3  ... n
0   0.7 0.1 0.55 0.8 ...0.7
1   0.4 0.8 0.5  0.1 ...0.1
...........................
n-2 0.1 0.1 0.5  0.5 ...0.2
n-1 0.2 0.2 0.2  0.1 ...0.4
n   0.1 0.1 0.1  0.4 ...0.7

it has shape nxn

I want to apply sklearns cosine_similarity : from sklearn.metrics.pairwise import cosine_similarity

but when i do cosine_similarity(df, dense_output = False) I get error:

Input contains NaN, infinity or a value too large for dtype('float64')

0 Answers
Related