title: Calculating a probability based on several variables in a Pandas dataframe
body: <p>I'm still very new to Python and Pandas, so bear with me...</p>
  
  <p>I have a dataframe of passengers on a ship that sunk. I have broken this down into other dataframes by male and female, and also by class to create probabilities for survival. I made a function that compares one dataframe to a dataframe of only survivors, and calculates the probability of survival among this group:</p>
  
  <pre><code>def survivability(total_pass_df, column, value):
      survivors = sum(did_survive[column] == value)
      total = len(total_pass_df)
      survival_prob = round((survivors / total), 2)
      return survival_prob
  </code></pre>
  
  <p>But now I'm trying to compare survivability among smaller groups - male first class passengers vs female third class passengers for example. I did make dataframes for both of these groups, but I still can't use my survivability function because I"m comparing two different columns - sex and class - rather than just one.</p>
  
  <p>I know exactly how I'd do it with Python - loop through the 'survived' column (which is either a 1 or 0), in the dataframe, if it equals 1, then add one to an index value, and once all the data has been gone through, divide the index value by the length of the dataframe to get the probability of survival....</p>
  
  <p>But I'm supposed to use Pandas for this, and I can't for the life of me work out in my head how to do it....</p>
  
  <p>:/</p>