-1

I have written this code in Jupyter, but I get an error message:

tokenizer = RegexpTokenizer (r'\w+')

career_df['How could the conversation have been more useful?']= career_df['How could the conversation have been more useful?'].apply(lambda x:tokenizer.tokenize(x.lower()))

The error is

AttributeError: 'function' object has no attribute 'lower'

tripleee
  • 175,061
  • 34
  • 275
  • 318
Praveen
  • 1
  • 1
  • 2
  • You should [edit] your question to indicate which libraries you `import` so we don't have to guess. Ideally, the code should constitute a [mre]. – tripleee Oct 22 '19 at 06:22

1 Answers1

0

Your "x" in lambda Expression is acting as a function when it should be a string. Try :

  career_df['How could the conversation have been more useful?']= career_df.apply(lambda x:tokenizer.tokenize(x['How could the conversation have been more useful?'].lower()))
Prototype
  • 54
  • 6