This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from time import gmtime, strftime | |
dados_covid = pd.DataFrame(data=data[7:220], columns=cols) | |
actual_date= strftime("%Y%m%d", gmtime()) | |
dados_covid['data_processamento'] = actual_date | |
dados_covid.head() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = [] | |
cols = [x.text for x in tabela_covid.findAll('th')] | |
rows = tabela_covid.findAll('tr') | |
for row in rows: | |
data_rows=row.findAll('td') | |
data_rows= [ele.text.strip() for ele in data_rows] | |
data.append([ele for ele in data_rows]) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
soup = BeautifulSoup(html.text , 'html.parser') | |
tabela_covid= soup.find(id='main_table_countries_today') | |
print(tabela_covid) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
import requests | |
html = requests.get("https://www.worldometers.info/coronavirus/") | |
#código 200 significa OK! | |
html.status_code |