Learn Web Scrapping with Beautiful Soup -Chocolate Scaping with BS

Can any one provide me with code for steps 5 to 7 within project. How to achieve values of ‘rating’ using steps suggested thanks…

Since this is a learning environment simply asking for an answer isn’t the way to go as per the forum guidelines- Guidelines - Codecademy Forums

A much better shout is trying work through the problem and seeking guidance on the forums when you get stuck, providing information about what you want to happen, what you’ve tried and what point you’re stuck on. The following FAQ goes into detail on how to set up a good question so please have a nosey through it and update your post accordingly.

1 Like


rating_links =soup.find_all(attrs ={“class”:“Rating”})

for td in rating_links[1:]:


got it…

rating_links =soup.find_all(attrs ={“class”:“Rating”})

for td in rating_links[1:]:

: )

Hi the highlighted line does not work …anyone thanks…

import codecademylib3_seaborn
from bs4 import BeautifulSoup
import requests
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np

webpage =requests.get(“https://content.codecademy.com/courses/beautifulsoup/cacao/index.html”)
soup =BeautifulSoup(webpage.content,“html.parser”)
rating_links =soup.find_all(attrs ={“class”:“Rating”})

for td in rating_links[1:]:

company_links =soup.find_all(attrs ={“class”:“Company”})

company =

for td in company_links[1:]:

coca_dict ={‘Company’:ratings, ‘Rating’:company}
coca_df =pd.DataFrame.from_dict(coca_dict)

mean_vals =coca_df.groupby(‘Company’).Rating.mean()

I’m glad you solved part of your problem but please do have a look at the FAQ linked above. Even if someone is willing to help, without a link to the project and formatted code you’re asking a great deal of them. It’s a community forum so the advice there is not to be just to be pedantic, it’s genuinely helpful to other users.