title: How to concatenate bit columns in Python Pandas?
body: <p>Seems like an easy question but I'm running into an odd error.  I have a large dataframe with 24+ columns that all contain 1s or 0s.  I wish to concatenate each field to create a binary key that'll act as a signature.</p>
  
  <p>However, when the number of columns exceeds 12, the whole process falls apart.</p>
  
  <pre><code>a = np.zeros(shape=(3,12))
  df = pd.DataFrame(a)
  df = df.astype(int)   # This converts each 0.0  into just 0
  df[2]=1               # Changes one column to all 1s
  
  #result
  
      0   1   2   3   4   5   6   7   8   9   10  11
  0   0   0   1   0   0   0   0   0   0   0   0   0
  1   0   0   1   0   0   0   0   0   0   0   0   0
  2   0   0   1   0   0   0   0   0   0   0   0   0
  </code></pre>
  
  <p>Concatenating function...</p>
  
  <pre><code>df['new'] = df.astype(str).sum(1).astype(int).astype(str)  # Concatenate
  df['new'].apply('{0:0&gt;12}'.format)                         # Pad leading zeros
  # result
      0   1   2   3   4   5   6   7   8   9   10  11  new
  0   0   0   1   0   0   0   0   0   0   0   0   0   001000000000
  1   0   0   1   0   0   0   0   0   0   0   0   0   001000000000
  2   0   0   1   0   0   0   0   0   0   0   0   0   001000000000
  </code></pre>
  
  <p>This is good.  However, if I increase the number of columns to 13, I get...</p>
  
  <pre><code>a = np.zeros(shape=(3,13))
  # ...same intermediate steps as above...
  
  
      0   1   2   3   4   5   6   7   8   9   10  11  12  new
  0   0   0   1   0   0   0   0   0   0   0   0   0   0   00-2147483648
  1   0   0   1   0   0   0   0   0   0   0   0   0   0   00-2147483648
  2   0   0   1   0   0   0   0   0   0   0   0   0   0   00-2147483648
  </code></pre>
  
  <p>Why am I getting -2147483648?  I was expecting 0010000000000</p>
  
  <p>Any help is appreciated!</p>