C3_W1 what's wrong with my bar plot code?

Hi, please kindly advise.

1 Like

Hi @Chengcheng_Wang

Thank you for your post.

In order to help you out, we need a little bit more of information regards the issue that you struggling.

Please, share with us any addition information like the output errors or a print of the code/plot.

Maybe a step by step procedure, your python code or the traceback would helpful.

Thanks!

Hi elirod,

please find here my code
`%matplotlib inline
import seaborn as sns

sns.barplot(
### BEGIN SOLUTION - DO NOT delete this comment for grading purposes
data=df_count_by_sentiment, # Replace None
x=‘sentiment’, # Replace None
y=‘count_reviews’, # Replace None
### END SOLUTION - DO NOT delete this comment for grading purposes
color=“blue”
)`
I actually did not meet any error info after running it in notebook and i got the bar plot results, but I got zero point for this block in the grades. Please kindly help me. Thank you!

1 Like

Hi @Chengcheng_Wang,

What is the exercise number of you assignment that this code correspond?

It was C2_W1. Thank you!

Looks like it is a problem with other code that this script depend on it

What is your ourput regards Exercice 6?

Hi @Chengcheng_Wang

I’ll need a little bit more information regards this issue. To make sure that it is not a platform error and guarantee that you have the correct grades for your assignment.

So, please, try to answer the following questions as best as you can. Don’t worry. I will help you as hard as i can.

Keep in mind that your assignment have 7 Exercises that are dependent each other.

So, here is the questions:

  1. What is the number of this Exercise?
  2. This is the only Exercise that you achieved a zero grade?
  3. What was your grade for the other 6 exercises?

Don’t worry. We will find out.

Hi elirod,

It was Exercise 7.

Yes, i got full grades for the other 6 exercises. My lab session ended already, so i cannot provide the ouput of Exercise 6 for now. Thank you!

1 Like

Oh, i got it.

Sorry for not being able to help you in time to complete the exercise.

Analyzing exercise 7 together with the result of exercise 6, I identified a possible cause for the grade 0.

As the bar chart displays both the sentiment rate and the count_reviews, it is possible that your count_reviews is not displaying the full value on the chart.

Example:

the count_review equals 2051, but your chart only displays 2000.

If this is the case, it is possible that the test will not pass.

Regards
elirod

That really makes sense! Thank you so much!

1 Like

Could you please, elaborate on this issue?

I have a valid barplot, that shows full-scale values of count_reviews, but grading systems doesn’t pass this test.
I tried to rescale y-axis. I tried to add more ticks. But this didn’t help.

my code:

sns.barplot(
    ### BEGIN SOLUTION - DO NOT delete this comment for grading purposes
    data=df_count_by_sentiment, # Replace None
    x="sentiment", # Replace None
    y="count_reviews", # Replace None
    ### END SOLUTION - DO NOT delete this comment for grading purposes
    color="blue"
);

my barchart:

I also tried to rescale to get more ticks:

ax = sns.barplot(
    ### BEGIN SOLUTION - DO NOT delete this comment for grading purposes
    data=df_count_by_sentiment, # Replace None
    x="sentiment", # Replace None
    y="count_reviews", # Replace None
    ### END SOLUTION - DO NOT delete this comment for grading purposes
    color="blue"
)
ax.set_yticks(range(0,2200,100))
ax.set(ylim=(0, 2200));

Any updates on this? I’m having the same issue. I get 0 points on the barplot excercise, this is what the report says:


[Executed at: Sat Aug 26 12:49:42 PDT 2023]

========================================================================================================================
Test 1 passed: Feature group was defined correctly.
Test 2 passed: prepare_data.py file was complete correctly.
Test 3 passed: Processing job completed.
Test 4 passed: Processing job status was pulled correctly.
Test 5 passed: 'feature_store_query.run' function was correctly used to construct Feature Store query.
Test 6 passed: The TSV files were generated by the processing job.
Test 7 passed: SQL query string was correctly set to find the total number of the reviews per sentiment.
Test 8 passed: 'feature_store_query_2.run' function was correctly used to construct Feature Store query.
Test 9 failed: There is a syntax error in the 'barplot' function. Please try again.
Test 10 passed: There was no problem found with the notebook syntax.
========================================================================================================================

What syntax error?

fwiw The cell looks as follows:

%matplotlib inline
import seaborn as sns

sns.barplot(
    ### BEGIN SOLUTION - DO NOT delete this comment for grading purposes
    data=df_count_by_sentiment, # Replace None
    x='sentiment', # Replace None
    y='count_reviews', # Replace None
    ### END SOLUTION - DO NOT delete this comment for grading purposes
    color="blue"
)

I’m having the same issue with the barplot exercise. I suppose the code that checks this exercise is broken.

2 Likes

Same problem here. No point for the bar chart.

Hello,

I found another thread discussing the same problem.

The solution over there was to remove/comment out the %matplotlib inline bit.

It has worked for me. :grinning: