C1W1- Assignment 3.2. How many reviews per sentiment?

Running this throws a full page of error. Could someone please help? Thank you.

Query data in Amazon Athena database cluster using the prepared SQL statement:

Hi @thuy,
Can you print your database_name variable in the previous cell print statement along with statement_count_by_sentiment?
Best Regards,
A. Sriharsha

2 Likes

Hi @sriharsha0806,
After rerun all chunks before the current chunk, I got df_count_by_sentiment to print out. But the very next line hit errors. (Note: I already deleted all tables and database in the S3 bucket before rerun each time -checking the table was empty as required in certain step above)

→ Then the next error is the same as what I experienced before when do “Query data in Amazon Athena database cluster using the prepared SQL statement:”

—> Next: another error when trying to Build array per star across all categories:


ImportError: matplotlib is required for plotting when the default backend “matplotlib” is selected.

Thank you for your help,
Thuy

1 Like

Hi @thuy,

Regarding the second error, you have to query count by category but your SQL query is counting by sentiment. So, kindly change the SQL query. As for other errors, Can you restart the Kernel and run the file once again? The first error is an import error, so you’re missing some lib while executing this command. while running the file, review whether S3 Bucket exists. Regarding the third error, it’s an attribute error, not an import error. When you executed the “3.1 Preparation for data visualization” imports cell, Was there a matplotlib import error? Let me know what errors you are facing when you are rerunning the file, to resolve the issues further. Also, please take a complete screenshot of the errors to resolve the issues. Happy learning

Best Regards,
A. Sriharsha

1 Like

I am also getting an error in this part. Although mine is different but I am completely clueless about what is causing it.
I would truly appreciate the help


Hi @mubshali,

Can you post the full screenshot of the ImportError? Also, did you review whether the s3 bucket you created exists in the previous steps, and Is your upload to the bucket successful?

Best Regards,
A. Sriharsha

I did review and the buckets do exist. I reviewed until the database was created. There was another issue I encountered while running the awswrangler. It said “no module named 'awswrangler”. So I installed it myself with the code “pip install awswrangler” . Maybe this is causing the error later on, I am not sure.

Hi @mubshali,

After the Table of Contents in your jupyter file, the very next cell contains the installation code of the libraries required for completing the assignment. You don’t need to install libraries separately.

# please ignore warning messages during the installation
!pip install --disable-pip-version-check -q sagemaker==2.35.0
!pip install --disable-pip-version-check -q pandas==1.1.4
"!pip install --disable-pip-version-check -q awswrangler==2.7.0"
!pip install --disable-pip-version-check -q numpy==1.18.5
!pip install --disable-pip-version-check -q seaborn==0.11.0
!pip install --disable-pip-version-check -q matplotlib===3.3.3

Can you share the output of this cell? I would like to check whether the libraries are installed properly.
Can you also take two screenshots of the Import Error image and post them? I am unable to read the image due to low resolution.
Best Regards,
A. Sriharsha

1 Like

Hi

I have the same error and it is solved after using your soultion — but I still don’t understand why it happens

Hi @baron33,

Welcome to PDS, can you post the error?

Best Regards,
A. Sriharsha

After changing count(category) still shows syntax error.


plz chk it, thx

Hi, I’m getting the first error, cannot found the specified bucket, can you help me out?