title: Check whether the two string columns contain each other in Python
body: <p>Given a small dataset as follows:</p>
  <pre><code>   id       a       b
  0   1     lol   lolec
  1   2   rambo     ram
  2   3      ki     pio
  3   4    iloc     loc
  4   5   strip  rstrip
  5   6  lambda  lambda
  </code></pre>
  <p>I would like to create a new column <code>c</code> based on the following criterion：</p>
  <p>If <code>a</code> is equal or substring of <code>b</code> or <em><strong>vise versa</strong></em>, then create a new column <code>c</code> with value <code>1</code>, otherwise keep it as <code>0</code>.</p>
  <p>How could I do that in Pandas or Python?</p>
  <p>The expected result:</p>
  <pre><code>   id       a       b  c
  0   1     lol   lolec  1
  1   2   rambo     ram  1
  2   3      ki     pio  0
  3   4    iloc     loc  1
  4   5   strip  rstrip  1
  5   6  lambda  lambda  1
  </code></pre>
  <p>To check whether <code>a</code> is in <code>b</code> or <code>b</code> is in <code>a</code>, we can use:</p>
  <pre><code>df.apply(lambda x: x.a in x.b, axis=1)
  df.apply(lambda x: x.b in x.a, axis=1)
  </code></pre>