title: Concatenating a string with part of another string in Python
body: <p>Problem:</p>
  
  <p>I have a csv file with partial city names in one column (usually missing the first one or two letters), and another column in the same file, that has other information and often contains the one or two missing letters in the end of that string.</p>
  
  <p>e.g.
  Column 1
  w York</p>
  
  <p>Column 3
  word word Ne</p>
  
  <p>My logic on how to approach this problem is to have a separate CSV file with valid city names, and perform the Python version of a VLOOKUP pre and post concatenation, so that it only concatenates if it does not already match with valid city data.</p>
  
  <p>I am stuck on how to actually pull one or two characters from the end of a string in column 3 (substring, but repeatedly down a column) and merge it with the start of a string in column 1, but I already know how to execute the rest of my idea.</p>
  
  <p>Here is a general script for concatenation using Pandas:</p>
  
  <pre><code>pd.concat([col1, col2.set_axis(col1.index[-len(col2):], inplace=False)], axis=1)
  </code></pre>
  
  <p>Would the addition of a -2 resolve the issue? i.e.</p>
  
  <pre><code>pd.concat([col1, col2.set_axis(col1.index[-len(col2)-2:], inplace=False)], axis=1)
  </code></pre>
  
  <p>Thank you!</p>