title: Select rows following specific patterns in a pandas dataframe
body: <p>I have a csv file that I read into a pandas dataframe. There are two specific columns, 'Notes' and 'ActivityType', that I want to use as criteria. If the 'Notes' column contains a string value of 'Morning exercise' or ' Morning workout' and/or the 'ActivityType' column contains any string value (majority of cells are Null and I don't want Null values counted) then make a new column 'MorningExercise' and insert a 1 if either conditions are met or a 0 if neither are.</p>
  
  <p>I have been using the code below to create a new column and insert a 1 or 0 if the text conditions are met in the 'Notes' column, but I have not figured out how to include a 1 if the 'ActivityType' column contains any string value.</p>
  
  <pre><code>JoinedTables['MorningExercise'] = JoinedTables['Notes'].str.contains(('Morning workout' or 'Morning exercise'), case=False, na=False).astype(int)
  </code></pre>
  
  <p>For the 'ActivityType' column, I would think to use the <code>pd.notnull()</code> function as the critieria.</p>
  
  <p>I really just need a way in python to see if either criteria are met in a row and if so, input a 1 or 0 in a new column. </p>