title: PANDAS Find the exact word and before word (multiple) in a column of string and append that, new column in python
body: <p><strong>Dataframe looks like this</strong></p>
  
  <pre><code>col_a
  Python PY is a general purpose PY language
  
  Programming PY language in Python PY 
  
  Its easier to understand  PY
  
  The syntax of the language is clean PY
  </code></pre>
  
  <p>This code I have tried to achive this functionality but not able to get the expected output. if any help appreciated.</p>
  
  <p>Here is the below code I approach with regular expressions:</p>
  
  <pre><code>df['col_a'].str.extract(r"([a-zA-Z'-]+\s+PY)\b")
  </code></pre>
  
  <p><strong>Desired output:</strong></p>
  
  <pre><code>col_a                                       col_b_PY     
  Python PY is a general purpose language         Python PY purpose PY
  Programming PY language in Python PY            Python PY Programming PY     
  Its easier to understand  PY                    understand PY 
  The syntax of the language is clean PY          clean  PY
  </code></pre>