title: Calculate cosine similarity for vectors between two pandas columns?
body: <p>I have the following Pandas Dataframe and need to find the cosine similarity by row. but my code returns a matrix of values. </p>
  
  <pre class="lang-py prettyprint-override"><code>import pandas as pd
  from sklearn.metrics.pairwise import cosine_similarity
  
  df = pd.DataFrame({"a" : [[0.1, 0.2],[0.5,0.3,0.3],[0.5]], "b" : [[0.1,0.2],[0.2,0.3,0.4],[0.5]]})
  
  cosine_similarity(df["a"].tolist(), df["b"].tolist())
  </code></pre>
  
  <p>I need to have an output with an extra column and a cosine value for each row.</p>