title: How to count special chars in column in Pandas?
body: <p>I am trying to get count of special chars in column using Pandas.
  But not getting desired output.</p>
  
  <p><strong>My .txt file is</strong>:</p>
  
  <pre><code>str
  Aa
  Bb
  ?? ?
  ###
  </code></pre>
  
  <p><strong>My Code is</strong> :</p>
  
  <pre><code>import pandas as pd
  
  df=pd.read_csv('inn.txt',sep='\t')
  
  def count_special_char(string):
      special_char = 0
  
      for i in range(len(string)):
          if(string[i].isalpha()):
              continue
          else:
              special_char = special_char + 1
  
  df["new"]=df.apply(count_special_char, axis = 0)
  print(df)
  </code></pre>
  
  <p><strong>And the output is:</strong></p>
  
  <pre><code>    str  new
  0    Aa  NaN
  1    Bb  NaN
  2  ?? ?  NaN
  3   ###  NaN
  </code></pre>
  
  <p><strong>Desired output is</strong>:</p>
  
  <pre><code>    str  new
  0    Aa  NaN
  1    Bb  NaN
  2  ?? ?  4
  3   ###  3
  </code></pre>
  
  <p>How to go ahead on this ?</p>