Many Errors - LAB _ Analyze data with Gemini assistance have issues - GSP1249

Hello,

We are finding many errors in tasks of above LAB. 

I am not sure how you claim it is working as expected. We find hard time working on tasks. Here is an eg:
 
++++
# Task 6.5 - Create the BigQuery client, and query the cleaned data view for positive and negative reviews, store the results in a dataframe and then show the first 10 records
client = bigquery.Client()
query = "SELECT sentiment, COUNT(*) AS count FROM `gemini_demo.cleaned_data_view` WHERE sentiment like 'negative%' OR sentiment like 'positive%' GROUP BY sentiment;"
query_job = client.query(query)
results = query_job.result().to_dataframe()
results.head(10)

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-10-3381304188> in <cell line: 0>()
      1 # Task 6.5 - Create the BigQuery client, and query the cleaned data view for positive and negative reviews, store the results in a dataframe and then show the first 10 records
----> 2 client = bigquery.Client()
      3 query = "SELECT sentiment, COUNT(*) AS count FROM `gemini_demo.cleaned_data_view` WHERE sentiment like 'negative%' OR sentiment like 'positive%' GROUP BY sentiment;"
      4 query_job = client.query(query)
      5 results = query_job.result().to_dataframe()

NameError: name 'bigquery' is not defined
 
 
Create a report of positive and negative review counts of Task 6. Prompt Gemini to analyze customer reviews for keywords and sentiment 
Analyze Customer Reviews with Gemini Using Python Notebooks
GSP1249

Throwing error with missing library.

Explain said
To fix this, you need to import the google.cloud.bigquery module at the beginning of your notebook.

!pip install google-cloud-bigquery
from google.cloud import bigquery

Create a report of positive and negative review counts step 5

Task 6.7 - Build the report.
plt.bar(sentiment, count, color='skyblue')
plt.xlabel("Sentiment")
plt.ylabel("Total Count")
plt.title("Bar Chart from BigQuery Data")
plt.show()

throw error

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-13-838654953> in <cell line: 0>()
      1 # Task 6.7 - Build the report.
----> 2 plt.bar(sentiment, count, color='skyblue')
      3 plt.xlabel("Sentiment")
      4 plt.ylabel("Total Count")
      5 plt.title("Bar Chart from BigQuery Data")

NameError: name 'plt' is not defined
+++++
 
The required libraries were missing in code that casuing issues. Some need to fix those. I am not sure, how folks worked in these .
 
Thanks .

 

0 0 15
0 REPLIES 0
Top Labels in this Space