title: Summing Booleans in a Dataframe
body: <p>I have a non-indexed Pandas dataframe where each row consists of numeric and boolean values with some NaNs. An example row in my dataframe might look like this (with variables above): </p>
  
  <pre><code>X_1  X_2  X_3 X_4   X_5  X_6 X_7  X_8  X_9   X_10  X_11  X_12
  24.4 True 5.1 False 22.4 55  33.4 True 18.04 False NaN   NaN
  </code></pre>
  
  <p>I would like to add a new variable to my dataframe, call it <code>X_13</code>, which is the number of True values in each row. So in the above case, I would like to obtain:</p>
  
  <pre><code>X_1  X_2  X_3 X_4   X_5  X_6 X_7  X_8  X_9   X_10  X_11  X_12 X_13
  24.4 True 5.1 False 22.4 55  33.4 True 18.04 False NaN   NaN  2
  </code></pre>
  
  <p>I have tried <code>df[X_13] = df[X_2] + df[X_4] + df[X_8] + df[X_10]</code> and that gives me what I want unless the row contains a <code>NaN</code> in a location where a Boolean is expected. For those rows, <code>X_13</code> has the value <code>NaN</code>. </p>
  
  <p>Sorry -- this feels like it should be absurdly simple. Any suggestions? </p>