OkBublewrap

Tableau-tabpy 사용 본문

Python/학습용

Tableau-tabpy 사용

옥뽁뽁 2023. 9. 3. 23:56

Anaconda Prompt 에서 pip install tabpy을 적고 tabpy를 실행한다.

tableau와 연동중 문제가 생겼다. 감성분석을 이용해서 시각화를 진행하는 것이였는데

nltk.download 문제였다.

 

동작을 완료할 수 없습니다. 

오류 코드: 6116dd27 분석 확장 프로그램과(와) 통신하는 동안 오류가 발생했습다. error processing script lookuperror : ********************************************************************** resource %1b[93mvader_lexicon%1b[0m not found. please use the nltk downloader to obtain the resource: %1b[31m>>> import nltk >>> nltk.download('vader_lexicon') %1b[0m for more information see: https://www.nltk.org/data.html attempted to load %1b[93msentiment/vader_lexicon.zip/vader_lexicon/vader_lexicon.txt%1b[0m searched in: - 'c:\\users\\wd/nltk_data' - 'c:\\users\\wd\\anaconda3\\nltk_data' - 'c:\\users\\wd\\anaconda3\\share\\nltk_data' - 'c:\\users\\wd\\anaconda3\\lib\\nltk_data' - 'c:\\users\\wd\\appdata\\roaming\\nltk_data' - 'c:\\nltk_data' - 'd:\\nltk_data' - 'e:\\nltk_data' - ''

 

해결방법

https://stackoverflow.com/questions/43546593/error-message-with-nltk-sentiment-vader-in-python

 

Error message with nltk.sentiment.vader in Python

I am a beginner at Python and am trying to use nltk.sentiment.vader but get a recurrent error message despite multiple attempts to fix it. I previously installed most of NTLK (3 modules were out o...

stackoverflow.com

python> import nltk> > nltk.download() 을 진행하면 nltk GUI가 뜨게 되는데 All Download를 진행한후 서버를 열어서 연동을 하니 실행이 되었다. 

 

FastCampus 태블로 강의

화면이 바뀔 때마다 계산을 하는 것 같다. 데이터를 저장을 하지 않아서 시간이 오래 걸린다. 

 

계산된 필드 정리 하기

필드명 : Random Normal 

스크립트 : 

SCRIPT_REAL("
from numpy import random as rd 
mu, sigma = 0, 1
return (rd.normal(mu, sigma, _arg1[0])).tolist()
",
SIZE()
)

-> 랜덤 에서 정규분포를 따르는 리스트 생성

 

필드명 : Sentiment Score

스크립트 : 

SCRIPT_REAL("
import nltk
from nltk.sentiment import SentimentIntensityAnalyzer
text = _arg1
scores = []
sid = SentimentIntensityAnalyzer()
for word in text:
    ss = sid.polarity_scores(word)
    scores.append(ss['compound'])
return scores
 ",
 ATTR([Text]))

scores 리스트에 단어에 대한 감정 분석 점수 넣기

 

결과를 봤을 때 화이자에 대한 Tweet을 분석을 한 것인데 긍정적인 단어가 전반적으로 많아 보인다. 부정적인 단어가 많이 나온 연도는 2021.12, 1월인데 백신에 대한 기다림에 관한 단어인 것 같다. 중립적인 단어가 많아서 크게 결과물은 없어 보인다. 

'Python > 학습용' 카테고리의 다른 글

Python-SQL 연결(데이터 추출)  (0) 2025.01.25
머신러닝 프로젝트 분석  (0) 2025.01.21
추천시스템 - 아이템 기반  (0) 2023.04.12
추천시스템 - 컨텐츠 기반  (0) 2023.04.11
Mercari Price Suggestion Challenge  (0) 2023.04.08