Hello.
I am trying to perform sentiment analysis using Python code in Stata.
I have confirmed that it runs smoothly in Python's Jupyter notebook.
However, I encountered errors starting from importing python packages when attempting to do everything in Stata, which I am more familiar with.
Basic packages like pandas and numpy did not cause errors in Stata, but nltk package shows a module not found error.
I checked the directory, but I do not know any hint to resolve the error.
I am unsure if it is a path configuration issue or another type of error.
If I cannot resolve the issue, I may have to handle data preprocessing in Stata, sentiment analysis in Python, and then import the analysis results back into Stata for additional analysis.
I would greatly appreciate any help.
I am trying to perform sentiment analysis using Python code in Stata.
I have confirmed that it runs smoothly in Python's Jupyter notebook.
However, I encountered errors starting from importing python packages when attempting to do everything in Stata, which I am more familiar with.
Code:
python : import pandas as pd import numpy as np import nltk nltk.download('vader_lexicon') from nltk.sentiment.vader import SentimentIntensityAnalyzer end
Code:
>>> import pandas as pd >>> import numpy as np >>> import nltk Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'nltk' (4 lines skipped)
I checked the directory, but I do not know any hint to resolve the error.
Code:
. python which pandas <module 'pandas' from 'C:\\Users\\inho8\\AppData\\Local\\Programs\\Python\\Python38\\lib\\site-packa > ges\\pandas\\__init__.py'> . python which numpy <module 'numpy' from 'C:\\Users\\inho8\\AppData\\Local\\Programs\\Python\\Python38\\lib\\site-packag > es\\numpy\\__init__.py'> . python which nltk Python module nltk not found
If I cannot resolve the issue, I may have to handle data preprocessing in Stata, sentiment analysis in Python, and then import the analysis results back into Stata for additional analysis.
I would greatly appreciate any help.
Comment