6. Web Scraping with Jupyter Notebooks
Activity 6.01: Web Scraping with Jupyter Notebook
Solution:
- Run the following code in your notebook to load the necessary libraries:
import pandas as pd import numpy as np import datetime import time import os import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns import requests from bs4 import BeautifulSoup %config InlineBackend.figure_format='retina' sns.set() # Revert to matplotlib defaults plt.rcParams['figure.figsize'] = (9, 6) plt.rcParams['axes.labelpad'] = 10 sns.set_style("darkgrid") %load_ext watermark %watermark -d -v -m -p \ requests,numpy,pandas,matplotlib,seaborn,sklearn
- After defining the
url
variable, load that page in the notebook using an IFrame. This can be done by running the following code:url = 'https://en.wikipedia.org/wiki/List_of_countries_and'\ Â Â Â Â Â Â '_dependencies_by_population' from IPython...