title: Get value from pandas series object
body: <p>I have a bunch of data files, with columns 'Names', 'Gender', 'Count', one file per one year. I need to concatenate all the files for some period, sum all counts for all unique names and add a new column with amount of consonant. I can't extract string value  from 'Names'. How can I implement that?
  Here is my code:</p>
  
  <pre><code>import os
  import re
  import pandas as pd
  
  PATH = ...
  def consonants_dynamics (years):
      names_by_year = {}
      for year in years:
          names_by_year[year] = pd.read_csv(PATH+"\\yob{}.txt".format(year), names =['Names', 'Gender', 'Count'])
      names_all = pd.concat(names_by_year, names=['Year', 'Pos'])
      dynamics = names_all.groupby('Names').sum().sort_values(by='Count', ascending=False).unstack('Names')
      dynamics['Consonants'] = dynamics.apply(count_vowels(dynamics.Names), axis = 1)
      return dynamics.head(10)
  
  def count_vowels (name):
      vowels = re.compile('A|E|I|O|U|a|e|i|o|u')
      return len(name) - len (vowels.findall(name))
  </code></pre>
  
  <p>If I run something like </p>
  
  <pre><code>a = consonants_dynamics(i for i in range (1900, 2001, 10))
  </code></pre>
  
  <p>I get the following error message</p>
  
  <pre><code>&lt;ipython-input-9-942fc155267e&gt; in consonants_dynamcis(years)
  ...
  ---&gt; 12     dynamics['Consonants'] = dynamics.apply(count_vowels(dynamics.Names), axis = 1)
  
  AttributeError: 'Series' object has no attribute 'Names'
  </code></pre>
  
  <p>I tried various ways but all failed. How can it be done?</p>