Beautiful Soup Scatter plot

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://s3.amazonaws.com/codecademy-content/courses/beautifulsoup/cacao/index.html')

soup = BeautifulSoup(webpage.content, "html.parser")

print(soup)

ratings_tags = soup.find_all(attrs={"td": "rating"})

ratings = []

for text in ratings_tags[1:]:
  ratings.append(float(text.get_text()))

plt.hist(ratings)
plt.show()

company_tags = soup.find_all(attrs={"td":"Company"})

company_names = []
cacoa_pcts = []

for name in company_tags[1:]:
  company_names.append(float(text.get_text()))
d = {"Company":company_names, 
"Ratings": ratings,
"CocoaPercentage":cacoa_pcts}
df = pd.DataFrame.from_dict(d)


avg_vals = df.groupby("Company").Ratings.mean()

ten_best = avg_vals.nlargest(10)
print(ten_best)



cacoa_tags = soup.select(".CocoaPercent")

for td in cacoa_tags[1:]:
  percent = int(float(td.get_text().strip("%")))
  cacoa_pcts.append(percent)





plt.scatter(df.CocoaPercentage, df.Ratings)

plt.show()

I don’t really know what I did wrong here but neither my histogram or my scatter plot is rendering at all. Any help is appreciated
You must select a tag to post in this category. Please find the tag relating to the section of the course you are on E.g. loops, learn-compatibility

When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with!

If you want to have the best chances of getting a useful answer quickly, make sure you follow our guidelines about how to ask a good question. That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer! :slight_smile: