title: Pandas get index and column from a cell in vectorized approach
body: <p>I have been playing with Pandas for a while, so I am not sure this is actually feasible straight away, let me expose my problem:</p>
  
  <p>I have an array such as:</p>
  
  <pre><code>0    |1|2|3|
  1    |6|4|3|
  2      |6|1|
  dtype: object
  </code></pre>
  
  <p>Then I have a Data Frame I generated to do one hot encoding of such array:</p>
  
  <pre><code>    [[False False False False False]
   [False False  False  False  False]
   [ False  False  False  False False]]
  </code></pre>
  
  <p>Each row corresponds to the array row and columns are the different values from each array element, separated by | .</p>
  
  <p>At this point I want to assign a True/False value to each cell depending of its index and column.
  The value of the cell(R,C) will be true if the column C is contained in the array element A[R]</p>
  
  <p>e.g.
  cell(0,1) = True</p>
  
  <p>Wanted to do this ina. vectorized approach, not sure I can do that just creating an initially empty dataframe, I may need to encode the index and column in the cell value?</p>
  
  <p>I was using get dummies, but taking a look to the internals I see an iteration over the tags, just wondering if that was replaceable (I also had to customise it a little as the type was applied later on, causing a huge memory output temporarily)</p>
  
  <p>Get Dummies</p>
  
  <pre><code>def str_get_boolean_dummies(arr, sep='|'):
  arr = arr.fillna('')
  try:
      arr = sep + arr + sep
  except TypeError:
      arr = sep + arr.astype(str) + sep
  
  tags = set()
  for ts in arr.str.split(sep):
      tags.update(ts)
  tags = sorted(tags - set([""]))
  
  dummies = pd.np.empty((len(arr), len(tags)), dtype=pd.np.bool)
  
  for i, t in enumerate(tags):
      pat = sep + t + sep
      dummies[:, i] = map_infer(arr.values, lambda x: pat in x)
  </code></pre>