How to resolve the "AttributeError: 'DataFrame' object has no attribute 'append' error" while using Sentiment Analysis in Statistica

How to resolve the "AttributeError: 'DataFrame' object has no attribute 'append' error" while using Sentiment Analysis in Statistica

book

Article ID: KB0070584

calendar_today

Updated On:

Products Versions
Spotfire Statistica 14.1 and 14.0.1 with HF 08

Description

Statistica has great integration with R and Python. We can achieve Sentiment Intensity Analysis in Statistica using R and Python packages. We have attached an example workspace in this article.

If you encounter the "AttributeError: 'DataFrame' object has no attribute 'append' error" while running the workspace, please follow the steps described in this article. 

This knowledge base article addresses these issues:
1.  While running the attached workspace in Statistica 14.0.1, 14.0.0, if you encounter an "append" error, as below:

User-added image

2. Or the node keeps running for an indefinite time.

Know cause:
The reason behind the "append" error was Pandas lib (version >2.0) deprecated the method `append()` that is being used in the file `PyWrapper.py`

Issue/Introduction

This article demonstrate the steps to run the "Sentiment_Analysis_Examples.sdm" workspace without any errors.

Environment

Windows

Resolution

The simple workaround is downgrading the Pandas to 1.x.x and downloading the nltk package by following the steps below:

1.  Open the command prompt and run:
  1. pip list //shows all the libraries with the version  
  2. pip uninstall pandas
  3. pip install pandas==1.3.5 
You will need to install the nltk (Natural Language Toolkit) processing package by using the following command: 
  1. pip install nltk 

When you first run the workspace, you will need to download the mentioned datasets.

  1. import nltk
  2. nltk.download('vader_lexicon')
  3. nltk.download('movie_reviews')
  4. nltk.download('punkt') 

 
NOTE: Customer should use V14.0.1 + HF08 or V14.1​​

Additional Information

https://investigate.ai/investigating-sentiment-analysis/comparing-sentiment-analysis-tools/

 

Attachments

How to resolve the "AttributeError: 'DataFrame' object has no attribute 'append' error" while using Sentiment Analysis in Statistica get_app