title: replace nested 'for loop' with lambda in python
body: <p>I am working on one task where I need to check the cosine similarity between two dataframe columns.
  I am using two for loop to iterate over two columns of data1 and data2 respectively.</p>
  <pre><code>for i in range(0,len(input_df)): 
      for j in range(0,len(data1)):
          ##check similarity ratio
          similarity_score= cosine_sim(input_df['Summary'].iloc[i],data1['Summary'].iloc[j])
          print(similarity_score)
  
  ###cosine_sim() is my function that gave similarity score.
  </code></pre>
  <p>how can i do this using <code>Lambda</code> instead of <code>for loop</code> as nested loop is taking much time.
  There are other operations as well which I am doing after checking the cosine similarity.</p>