title: Python/Pandas: How to Match List of Strings with a DataFrame column
body: <p>I want to compare two columns: <code>Description</code> and <code>Employer</code>. I want to see if any keywords from <code>Employer</code> are found in the <code>Description</code> column. I have broken the <code>Employer</code> column down to words and converted to a list. Now I want to see if any of those words are in the corresponding <code>Description</code> column.</p>
  <p>Sample input:</p>
  <pre><code>print(df.head(25))
  
  
            Date           Description   Amount  AutoNumber  \
  0    3/17/2015  WW120 TFR?FR xxx8690   140.00       49246   
  2    3/13/2015  JX154 TFR?FR xxx8690   150.00       49246   
  5     3/6/2015   CANSEL SURVEY E PAY  1182.08       49246   
  9     3/2/2015  UE200 TFR?FR xxx8690   180.00       49246   
  10   2/27/2015  JH401 TFR?FR xxx8690   400.00       49246   
  11   2/27/2015   CANSEL SURVEY E PAY   555.62       49246   
  12   2/25/2015  HU204 TFR?FR xxx8690   200.00       49246   
  13   2/23/2015  UQ263 TFR?FR xxx8690   102.00       49246   
  14   2/23/2015  UT460 TFR?FR xxx8690   200.00       49246   
  15   2/20/2015   CANSEL SURVEY E PAY  1222.05       49246   
  17   2/17/2015  UO414 TFR?FR xxx8690   250.00       49246   
  19   2/11/2015  HI540 TFR?FR xxx8690   130.00       49246   
  20   2/11/2015  HQ010 TFR?FR xxx8690   177.00       49246   
  21   2/10/2015  WU455 TFR?FR xxx8690   200.00       49246   
  22    2/6/2015  JJ500 TFR?FR xxx8690   301.00       49246   
  23    2/6/2015   CANSEL SURVEY E PAY  1182.08       49246   
  24    2/5/2015  IR453 TFR?FR xxx8690   168.56       49246   
  26    2/2/2015  RQ574 TFR?FR xxx8690   500.00       49246   
  27    2/2/2015  UT022 TFR?FR xxx8690   850.00       49246   
  28  12/31/2014  HU521 TFR?FR xxx8690   950.17       49246   
  
                     Employer  
  0   Cansel Survey Equipment  
  2   Cansel Survey Equipment  
  5   Cansel Survey Equipment  
  9   Cansel Survey Equipment  
  10  Cansel Survey Equipment  
  11  Cansel Survey Equipment  
  12  Cansel Survey Equipment  
  13  Cansel Survey Equipment  
  14  Cansel Survey Equipment  
  15  Cansel Survey Equipment  
  17  Cansel Survey Equipment  
  19  Cansel Survey Equipment  
  20  Cansel Survey Equipment  
  21  Cansel Survey Equipment  
  22  Cansel Survey Equipment  
  23  Cansel Survey Equipment  
  24  Cansel Survey Equipment  
  26  Cansel Survey Equipment  
  27  Cansel Survey Equipment  
  28  Cansel Survey Equipment  
  </code></pre>
  <p>I tried something like this, but it doesn't seem to work.:</p>
  <pre><code>df['Text_Search'] = df['Employer'].apply(lambda x: x.split(&quot; &quot;))
  df['Match'] = np.where(df['Description'].str.contains(&quot;|&quot;.join(df['Text_Search'])), &quot;Yes&quot;, &quot;No&quot;)
  </code></pre>
  <p>My desired output would be as shown below:</p>
  <pre><code>          Date           Description   Amount  AutoNumber  \
  0    3/17/2015  WW120 TFR?FR xxx8690   140.00       49246   
  2    3/13/2015  JX154 TFR?FR xxx8690   150.00       49246   
  5     3/6/2015   CANSEL SURVEY E PAY  1182.08       49246   
  9     3/2/2015  UE200 TFR?FR xxx8690   180.00       49246   
  10   2/27/2015  JH401 TFR?FR xxx8690   400.00       49246   
  11   2/27/2015   CANSEL SURVEY E PAY   555.62       49246   
  12   2/25/2015  HU204 TFR?FR xxx8690   200.00       49246   
  13   2/23/2015  UQ263 TFR?FR xxx8690   102.00       49246   
  14   2/23/2015  UT460 TFR?FR xxx8690   200.00       49246   
  15   2/20/2015   CANSEL SURVEY E PAY  1222.05       49246   
  17   2/17/2015  UO414 TFR?FR xxx8690   250.00       49246   
  19   2/11/2015  HI540 TFR?FR xxx8690   130.00       49246   
  20   2/11/2015  HQ010 TFR?FR xxx8690   177.00       49246   
  21   2/10/2015  WU455 TFR?FR xxx8690   200.00       49246   
  22    2/6/2015  JJ500 TFR?FR xxx8690   301.00       49246   
  23    2/6/2015   CANSEL SURVEY E PAY  1182.08       49246   
  24    2/5/2015  IR453 TFR?FR xxx8690   168.56       49246   
  26    2/2/2015  RQ574 TFR?FR xxx8690   500.00       49246   
  27    2/2/2015  UT022 TFR?FR xxx8690   850.00       49246   
  28  12/31/2014  HU521 TFR?FR xxx8690   950.17       49246   
  29  12/30/2014  WZ553 TFR?FR xxx8690   200.00       49246   
  32  12/29/2014  JW173 TFR?FR xxx8690   300.00       49246   
  33  12/24/2014   CANSEL SURVEY E PAY  1219.21       49246   
  34  12/24/2014   CANSEL SURVEY E PAY   434.84       49246   
  36  12/23/2014  WT002 TFR?FR xxx8690   160.00       49246   
  
                     Employer                  Text_Search Match  
  0   Cansel Survey Equipment  [Cansel, Survey, Equipment]    No  
  2   Cansel Survey Equipment  [Cansel, Survey, Equipment]    No  
  5   Cansel Survey Equipment  [Cansel, Survey, Equipment]    Yes 
  9   Cansel Survey Equipment  [Cansel, Survey, Equipment]    No  
  10  Cansel Survey Equipment  [Cansel, Survey, Equipment]    No  
  11  Cansel Survey Equipment  [Cansel, Survey, Equipment]    Yes  
  12  Cansel Survey Equipment  [Cansel, Survey, Equipment]    No  
  13  Cansel Survey Equipment  [Cansel, Survey, Equipment]    No  
  14  Cansel Survey Equipment  [Cansel, Survey, Equipment]    No  
  15  Cansel Survey Equipment  [Cansel, Survey, Equipment]    Yes  
  17  Cansel Survey Equipment  [Cansel, Survey, Equipment]    No  
  19  Cansel Survey Equipment  [Cansel, Survey, Equipment]    No  
  20  Cansel Survey Equipment  [Cansel, Survey, Equipment]    No  
  21  Cansel Survey Equipment  [Cansel, Survey, Equipment]    No  
  22  Cansel Survey Equipment  [Cansel, Survey, Equipment]    No  
  23  Cansel Survey Equipment  [Cansel, Survey, Equipment]    Yes  
  24  Cansel Survey Equipment  [Cansel, Survey, Equipment]    No  
  26  Cansel Survey Equipment  [Cansel, Survey, Equipment]    No  
  27  Cansel Survey Equipment  [Cansel, Survey, Equipment]    No  
  28  Cansel Survey Equipment  [Cansel, Survey, Equipment]    No  
  29  Cansel Survey Equipment  [Cansel, Survey, Equipment]    No  
  32  Cansel Survey Equipment  [Cansel, Survey, Equipment]    No  
  33  Cansel Survey Equipment  [Cansel, Survey, Equipment]    Yes  
  34  Cansel Survey Equipment  [Cansel, Survey, Equipment]    Yes  
  36  Cansel Survey Equipment  [Cansel, Survey, Equipment]    No 
  </code></pre>