Lab exercises from the IBM Coursera courses.
data = requests.get(url).text print(data)
soup = BeautifulSoup(data, 'html.parser')
amazon_data = pd.DataFrame(columns=["Date", "Open", "High", "Low", "Close", "Volume"])
for row in soup.find("tbody").find_all('tr'): col = row.find_all("td") date = col[0].text Open = col[1].text high = col[2].text low = col[3].text close = col[4].text adj_close = col[5].text volume = col[6].text
amazon_data = pd.concat([amazon_data,pd.DataFrame({"Date":[date], "Open":[Open], "High":[high], "Low":[low], "Close":[close], "Adj Close":[adj_close], "Volume":[volume]})], ignore_index=True)
amazon_data.head()
soup.title
list(amazon_data.columns)
print(amazon_data['Open'].iloc[4])