title: COUNTIF in pandas python over multiple columns with multiple conditions
body: <p>I have a dataset wherein I am trying to determine the number of risk factors per person. So I have the following data:</p>
  
  <pre><code>Person_ID  Age  Smoker  Diabetes
        001   30       Y         N
        002   45       N         N
        003   27       N         Y
        004   18       Y         Y
        005   55       Y         Y
  </code></pre>
  
  <p>Each attribute (Age, Smoker, Diabetes) has its own condition to determine whether it is a risk factor. So if Age >= 45, it's a risk factor. Smoker and Diabetes are risk factors if they are "Y". What I would like is to add a column that adds up the number of risk factors for each person based on those conditions. So the data would look like this:</p>
  
  <pre><code>Person_ID  Age  Smoker  Diabetes  Risk_Factors
        001   30       Y         N             1
        002   25       N         N             0
        003   27       N         Y             1
        004   18       Y         Y             2
        005   55       Y         Y             3
  </code></pre>
  
  <p>I have a sample dataset that I was fooling around with in Excel, and the way I did it there was to use the COUNTIF formula like so:</p>
  
  <p><code>=COUNTIF(B2,"&gt;45") + COUNTIF(C2,"=Y") + COUNTIF(D2,"=Y")</code></p>
  
  <p>However, the actual dataset that I will be using is way too large for Excel, so I'm learning pandas for python. I wish I could provide examples of what I've already tried, but frankly I don't even know where to start. I looked at <a href="https://stackoverflow.com/questions/20995196/python-pandas-counting-and-summing-specific-conditions">this question</a>, but it doesn't really address what to do about applying it to an entire new column using different conditions from multiple columns. Any suggestions?</p>