I calculated the cosine similarity of a dataframe similar to the following:
ciiu4n4 A0111 A0112 A0113
A0111 14 7 6
A0112 16 55 3
A0113 15 0 112
using this code:
data_cosine = mpg_data.drop(['ciiu4n4'], axis=1)
result = cosine_similarity(data_cosine)
I get as a result an array like this:
[[ 1. 0.95357118 0.95814892 ]
[ 0.95357118 1. 0.89993795 ]
[ 0.95814892 0.89993795 1. ]]
However, I need the result as a dataframe similar to the original one. I can't do it manually, because the original dataframe is 600 x 600.
The result that I need needs to look something similar like:
ciiu4n4 A0111 A0112 A0113
A0111 1. 0.95357118 0.95814892
A0112 0.95357118 1. 0.89993795
A0113 0.95814892 0.89993795 1.