title: Using regex matched groups in pandas dataframe replace function
body: <p>I'm just learning python/pandas and like how powerful and concise it is.</p>
  
  <p>During data cleaning I want to use replace on a column in a dataframe with regex but I want to reinsert parts of the match (groups).</p>
  
  <p>Simple Example:
  lastname, firstname -> firstname lastname</p>
  
  <p>I tried something like the following (actual case is more complex so excuse the simple regex):</p>
  
  <pre><code>df['Col1'].replace({'([A-Za-z])+, ([A-Za-z]+)' : '\2 \1'}, inplace=True, regex=True)
  </code></pre>
  
  <p>However, this results in empty values. The match part works as expected, but the value part doesn't.
  I guess this could be achieved by some splitting and merging, but I am looking for a general answer as to whether the regex group can be used in replace.</p>