Yagnikbavishi
3 min readJul 27, 2021

Practical-1 |Practical-2 | Practical-3 | Practical-4 | Practical-5 | Practical-6 | Practical-7 | Practical-8 | Practical-9 | Practical-10 | Practical-11| Practical-12 |

Practical:-1

AIM:- Web Scraping using Python

This blog is basically for basic data scraping from website data. Data Science is all about working with data. So one of the most parts of data science is data gathering. So here we scrape data from a webpage. There are many ways for data gathering.

Introduction

Web scraping is used for how we describe the use of a program or algorithm to extract and process large amounts of data from the web. Web scraping is the one type of process using bots that can extract content and data from a website. Unlike screen scraping, which only copies pixels displayed onscreen, web scraping extracts the process of underlying HTML code and, with it, data stored in a database. The scraper can then replicate the entire website content elsewhere. Using web scraping we can gather more data for analysis purposes.

For Data scraping, I used the following libraries:-

(1) Selenium:- Chrome Driver

Installation:- pip install selenium

(2) Beautiful Soup:- web scrapping

Installation:- pip install beautifulsoup4

(3) Pandas:- Data Manipulation

Installation:- pip install pandas

Implementation

We have installed all the libraries and import them into the python file.

Setup Chrome Driver:

Download Chrome Driver. From this Link.

We add to our python file.

URL:-https://www.flipkart.com/search?q=laptop&otracker=search&otracker1=search&marketplace=FLIPKART&as-show=on&as=off&as-pos=1&as-type=HISTORY&as-backfill=on

The above URL we have to use for the web Web scraping. This is laptop data of the Flipkart e-commerce website and this data we will use for the web scraping. The below code represents that how using chrome driver we can get the URL.

We extract data of laptop name, price, and features. So below code is represent how data we create an empty list.

Now Beautiful Soup Object So that we can perform some operations on it.

Now we have to fetch the names, prices, and features of laptops.

This data we have converted into the .csv file using the pandas library.

Conclusion
We can fetch any data from a webpage by using a web scrapping library like beautiful soup, scrappy, etc. After converting into Pandas we can apply all pandas functions on that data.

Github Link:-

https://github.com/YagnikBavishi/DataScience/tree/main/Web_Scraping_PR1