I was doing this project and just noticed that unlike all projects there is no video walkthrough available for this one. So thought it might help someone who is having trouble completing it.
from bs4 import BeautifulSoup
import requests
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
I had to go through the same issue, it was super slowâŚ
I donât know maybe itâs something to do with the backend or the database where the data is being fetched from.
This was super helpful, thank you. I spent 30 minutes trying to work out why my scatter graph didnât look right until I noticed that it had the same y-axis as the histogram. Turns out thatâs what plt.clf() is for!
Thanks OP! However, Iâm getting this weird issue:
Traceback (most recent call last):
File "script.py", line 53, in <module>
plt.scatter(df.CocoaPercentage, df.Rating)
File "/usr/local/lib/python3.6/dist-packages/pandas/core/generic.py", line 5179, in __getattr__
return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'CocoaPercentage'
If anyone knows what I can do to fix, please let me know!!
To create the lists ratings, companies, and cocoa, why do you end your code in [1:]? I saw codecademy use [0] before but never explained why or what it is.
Hello. While weâre comparing notes on web scraping, I could use a little help/pointers here. So I have this code and Iâm trying to capture the duration of a movie file but Iâve hit a roadblock
import requests
from bs4 import BeautifulSoup
url = "https://yts.mx/movies/the-thirteenth-tale-2013"
page = requests.get(url)
soup = BeautifulSoup(page.text, "html.parser")
for tag in soup.find_all('span', class_ = "icon-clock"):
print(tag)
Same issue, although mine was because printing the ratings and converting to floats took forever; other data types (sans convertion) worked much faster