title: python AttributeError: 'str' object has no attribute '' for an object which is a panda data frame
body: <p>I want to assign a part of a dataframe object I created that contain values that I need to a new object. However, I'm getting an error when I try to run my python file, which says that the string object has no attribute for the object that I created containing the values. Not sure what is wrong. </p>
  
  <pre><code>AttributeError: 'str' object has no attribute 'vowel_map'
  </code></pre>
  
  <p>The training.txt file is:</p>
  
  <pre><code>COED:K OW1 EH2 D
  PURVIEW:P ER1 V Y UW2
  HEHIR:HH EH1 HH IH0 R
  MUSCLING:M AH1 S AH0 L IH0 NG
  NONPOISONOUS:N AA0 N P OY1 Z AH0 N AH0 S
  LAVECCHIA:L AA0 V EH1 K IY0 AH0
  BUCKLED:B AH1 K AH0 L D
  EATEN:IY1 T AH0 N
  SCIMED:S AY1 M EH2 D
  MORTIS:M AO1 R T IH0 S
  CONSERVATOR:K AH0 N S ER1 V AH0 T ER0
  </code></pre>
  
  <p>The python file I'm running is:</p>
  
  <pre><code>import pandas as pd
  import string
  
  vowels = ('AA','AE','AH','AO','AW','AY','EH','ER','EY','IH','IY','OW','OY','UH','UW')
  
  def remove_stress(string):
      if type(string) in [list, tuple]:
          string = ' '.join(string)
      return ''.join([i for i in string if not i.isdigit()]).split()
  
  def phoneme_map(phon_list, phoneme_list):
      return [1 if phoneme in phoneme_list else 0 for phoneme in phon_list]
  
  def get_words(file_path):
      words = pd.read_csv(file_path, sep=':', names = ['word', 'string_of_phon'])
      words['phon_list'] = words.string_of_phon.apply(str.split)
      words['stressless_phon_list'] = words.string_of_phon.apply(remove_stress)
      words['vowel_map'] = words.stressless_phon_list.apply(phoneme_map, args = (vowels,))
  
      return words
  
  if __name__ == '__main__':
      data_loc = 'training.txt'
      words = get_words(data_loc)
  
      word_vowels = [word.vowel_map for word in words]
  </code></pre>