title: Compare each element of two series/df with a custom function in pandas without a for-loop
body: <p>I built a custom function two compare two url's to get the longest common subsequence (lcs).</p>
  <pre><code>def lcs_dynamic(url1, url2): 
     maths: compare url1 with url2
     return lcs
  </code></pre>
  <p>I have a series s1 and a series s2 with a bunch of url's (13.000pcs). I want to compare each element of both series with each other (169.000.000 comparisons)</p>
  <p>I did it with two nested for-loops, but it's way too slow.</p>
  <pre><code>for index1, value1 in s1.items():
      for index2, value2 in s2.items():
          url1 = value1
          url2 = value2
          if (index1 != index2):
              lcs1 = lcs_dynamic(url1, url2) //usage of my custom function
          overlap = lcs1 /len(url2)
          print({index1}, {index2}, {url1}, {url2}, {overlap})
  </code></pre>
  <p>Is there a better way to do it?</p>
  <p>I thought about the apply() method, but I couldn't figure out how to get access to series2 and the second url as my custom function lcs_dynamic needs both urls as arguments</p>
  <p><code>series1.apply(lcs_dynamic(url1, url2))</code> --&gt; in this case I would get the url1 from series1 but how can get access to the series2 and url2... don't know.</p>
  <p>Thanks in advance!</p>