title: Pandas - Groupby with conditional formula
body: <pre><code>   Survived  SibSp  Parch
  0         0      1      0
  1         1      1      0
  2         1      0      0
  3         1      1      0
  4         0      0      1
  </code></pre>
  
  <p>Given the above dataframe, is there an elegant way to <code>groupby</code> with a condition?
  I want to split the data into two groups based on the following conditions:</p>
  
  <pre><code>(df['SibSp'] &gt; 0) | (df['Parch'] &gt; 0) =   New Group -"Has Family"
   (df['SibSp'] == 0) &amp; (df['Parch'] == 0) = New Group - "No Family"
  </code></pre>
  
  <p>then take the means of both of these groups and end up with an output like this:</p>
  
  <pre><code>               SurvivedMean
   Has Family    Mean
   No Family     Mean
  </code></pre>
  
  <p>Can it be done using groupby or would I have to append a new column using the above conditional statement?</p>