title: Python pandas dataframe slicing, with if condition
body: <p>I have a DataFrame object, with multiple columns: <code>business_id</code>, <code>categories</code>, <code>type_of_business</code>...</p>
  
  <p>I have managed to create a smaller DataFrame with only <code>business_id</code> and <code>categories</code> by column indexing on the original DataFrame object.</p>
  
  <p><code>categories</code> is a list of certain strings.Example: <code>['Restaurant, 'food', 'bakery']</code> - for each <code>business_id</code>.</p>
  
  <p>One of the categories is <code>Restaurants</code>. How would I retrieve only those business ids where the word <code>Restaurants</code> is in the categories list.</p>
  
  <p>Pseudocode:</p>
  
  <pre><code>for row in smaller_DataFrame:
      if 'Restaurants' in row['categories']:
          add this business_id to some dictionary.
  </code></pre>
  
  <p>I am interested in how I would incorporate the <code>if</code> condition in a DataFrame object.</p>
  
  <p>Thanks in advance.</p>