인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

jkpark2826's profile image
jkpark2826

asked

[NLP] Python text analysis and natural language processing through IMDB movie review sentiment analysis

[2/4] NLP Text Data Preprocessing

'list' object has no attribute 'apply' 문의

Written on

·

1.3K

0

train['num_words'] = clean_train_reviews.apply(lambda x: len(str(x).split()))

이부분이 처리가 안되네요 ;;

파이참으로 하는데요 , AttributeError: 'list' object has no attribute 'apply' 라고 에러가 뜹니다....

pythonNLP

Answer 3

0

저는 이렇게 하니까 잘 되네요. ;; 

0

이것도 안되는데요..ㅠ

0

아래와 같이 변형하셔서 적용하시면 될 듯 싶습니다..

count_words_f = lambda x: len(str(x).split())

train['num_words'] = list(map(count_words_f, clean_train_reviews))

count_uniq_words_f = lambda x: len(set(str(x).split()))

train['num_uniq_words'] = list(map(count_uniq_words_f, clean_train_reviews))

jkpark2826's profile image
jkpark2826

asked

Ask a question