Coders Packet

Webscappinng using Python

By Rahul Kumar

This is a Webscrapping Project using Python. The website is scrapped and the data collected is stored in Books.csv. And Price vs No of Books graph is plotted.

Overview: This is a Webscrapping Project using Python. The Website that is scrapped in this project is 'http://books.toscrape.com' and the data collected is stored to Books.csv. And price vs No of Books graph is also plotted.

The Python libraries used are:

1. requests 
2. BeautifulSoup
3. pandas 
4. matplotlib.pyplot 

The Project is divided into 2 parts:

1. WebScrapping 

2. Plotting and Storing the scrapped data.

First part has 3 function:

1. findUrls() : This function returns the list of urls of all the page of the above mentioned page.

2. getBooksLinks() : This function takes the list of urls as parameter and returns the list of link of all books present in the page.

3. details() : This function takes the list of link of all books as parameter and returns the list of list [name,price,quantity] of each book present in the page.

Second part is conversion of scrapped data to pandas dataframe so that it can be plotted.

The dataframe is grouped in terms of price and plotted against the quantity.

In last cell, The data is stored in "Book.csv".

Download Complete Code

Comments

No comments yet