Week1 Lab Exercise 3: Empty DataFrame


I am trying to run a SQL query to form a data frame using the Jupyter Notebook provided by the lab, yet the data frame returned is empty. The code chunk I ran was

statement_count_by_sentiment = """
SELECT sentiment, COUNT(sentiment) AS count_sentiment
FROM reviews
GROUP BY sentiment
ORDER BY sentiment
df_count_by_sentiment = wr.athena.read_sql_query(


And the return was

Empty DataFrame
Columns: []
Index: []

I’ve gone through all the previous steps, and it worked all fine until this part. Any hints and insights are appreciated.


Hi Agnes!

Welcome to discourse! What you did is basically replicate the query in statement_count_by_sentiment. In the exercise you should calculate the total number of reviews per product_category in the table reviews.

I hope this helps! Let me know how it goes.


Hi Raul,

Thanks for you reply! If I understand it correctly, calculating the reviews per product_category is Exercise 3, which I have also attempted to do and the query returned was empty as well. I don’t think not getting data from the query is because I wrote wrong queries because the code I pasted here is sample code provided by the lab, and because of the empty data frame, I am unable to plot the data, which is the step after the code here. I guess all these code is provided for us to learn the syntax and to do the Exercise 3, but now it doesn’t seem to work so I am confused.



Issue solved. The only thing I did was changeaccount_id = sess.account_id to account_id = sess.account_id() in chunk 19 in 2.1. Register S3 dataset files as a table for querying. Not sure if the syntax error is due to me or the notebook, I just put this here in case anyone meets the same problem in the future.


Awesome! I’m glad you figured it out. :dart:

Thanks for sharing!