title: How to create element by element comparison matrix in pandas?
body: <p>Suppose there is a pandas series (e.g. the following)</p>
  <pre><code>1 A
  2 C
  3 A
  4 B
  5 C
  </code></pre>
  <p>There is also a list of elements, e.g. [A,B,C,D]. The goal is to get a dataframe with columns of this list and the same rows, as in series, and each cell is a Boolean value which indicates if the value in series is equal to value of column. In my example it would be the following:</p>
  <pre><code>    A     B     C     D
  1 True  False False False
  2 False False True  False
  3 True  False False False
  4 False True  False False
  5 False False True  False
  </code></pre>
  <p>Of course this can be achieved with a simple for loop (smth like this:)</p>
  <pre><code>for i in the_list:
     df[i] = the_series == i
  </code></pre>
  <p>But this is painfully slow, especially when the list is large. So what I am asking is if there is a faster &quot;pandas-style&quot; way to achieve this?</p>