title: Trying to check if String in Python follows the correct pattern (good formatting)
body: <p>I have a dataset that contains columns with strings. One of those columns contain a identifier. Now I want to check if that identifier follows this pattern: e.g. AB12CD, so 2 letters(Capital), 2 numbers followed by 2 letters again.</p>
  
  <p>The data is stored in a pandas data frame. I have:</p>
  
  <pre><code>for i in range(0, len(data.columns)):
      if data.columns[i] == 'identifier ':
          pattern = re.compile("[A-Z][A-Z][0-9][0-9][A-Z][A-Z]")
          if pattern.match(data.ix[i, 0]):
              data['identifier Check'] = 'Ok'
          else:
              data['identifier  Check'] = 'identifier Format incorrect'
  </code></pre>
  
  <p>But this is not working. It puts on every row OK or Corp Key incorrect. Depending on the first row.</p>
  
  <p>Can anybody help me? 
  Thanks!</p>