Analytics Vidhya
Published in

Analytics Vidhya

Photo by Clément H on Unsplash

Web Scraping with Python using BeautifulSoup

How to parse and extract data from HTML documents in simple steps

Libraries needed

Extracting the HTML file

HTML code extracted from the web page

Creating a BeautifulSoup object

Structured BeautifulSoup object

Inspecting the Wikipedia page

Inspecting the web page’s elements

Extracting the table

Creating a pandas DataFrame

Pandas DataFrame created from the Wikipedia table



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store