title: Pandas use dataframe as dictionary or lookup
body: <p>Not winning here. Need to use a free text field passed into a dataframe to lookup a different column in a second data frame:</p>
  <blockquote>
  <pre><code>df1 = pd.read_csv('Hotel_reviews.csv')
  
  ...
  user:     Review:
  Julie     'Sheets were dirty'
  Samantha  'Meal arrived cold'
  Rachel    'Cocktails were delicious'
  ]
  ...
  </code></pre>
  </blockquote>
  <p>imagine lots of data above ^</p>
  <blockquote>
  <pre><code>df2 = [{'Keyword':['Sheets','Cocktails','Meal'],
  'Department' :['Bedrooms','Restaurant','Restaurant'],
  'Issue Type':['Beds','Drinks','Food']}]
  </code></pre>
  </blockquote>
  <p>I've tried a number of methods to arrive at this:</p>
  <blockquote>
  <pre><code>df3 =
  user:     Review:                     Department:     Issue Type:
  Julie     'Sheets were dirty'         'Bedrooms'      'Beds'
  Samantha  'Meal arrived cold'         'Restaurant'    'Food'
  Rachel    'Cocktails were delicious'  'Restaurant'    'Drinks'
  </code></pre>
  </blockquote>
  <p>This is what I've tried:</p>
  <h1>TRY1</h1>
  <blockquote>
  <pre><code>def find_dept(review):
      words = review.split(' ')
      for word in words:
          if word.isin(df2['Keyword']):
               return df2[df2['word'] ==word]['Department']
  
  dept = df['Review'].apply(find_dept)
  </code></pre>
  </blockquote>
  <h1>TRY2</h1>
  <blockquote>
  <pre><code>for dept in df2['Department']:    
       if dept.isin(review):
            return True
  </code></pre>
  </blockquote>
  <h1>TRY3</h1>
  <blockquote>
  <pre><code>review_dict = df2.to_dict('series')
  def r_dict(review):
      return review_dict[review]
  
  dept = df['Review'].apply(r_dict)
  </code></pre>
  </blockquote>
  <p>Needless to say, I am struggling......</p>
  <p>apologies for not exactly correct formatting, this is a made up examples and my caffeine levels are dipping</p>