Professional Documents
Culture Documents
Parsing The Web: Let S Find The Following Data For The First 100 Movies
Parsing The Web: Let S Find The Following Data For The First 100 Movies
Let´s find the following data for the first 100 movies:
Código Implementado:
import requests
# Import the beautiful soup
from bs4 import BeautifulSoup
# Export library
import pandas as pd
TARGET_URL='https://www.the-numbers.com/movie/budgets/all'
myData=requests.get(TARGET_URL)
# Using beautiful soup library for parsing fetched data
soup= BeautifulSoup(myData.text, 'html.parser')
elements=soup.find_all("tr")
for elem in elements:
valores = []
dat = {}
itemtd=elem.find_all("td")
if itemtd:
valores.append(itemtd[1].text)
valores.append(itemtd[2].text)
valores.append(itemtd[3].text)
dataFrame = pd.DataFrame.from_dict(data)
print(dataFrame)