Skip to content

sylvester-onyango-wanina/Web-Scraping

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

🕸️ Web Scraping Project

Author: Sylvester Wanina Cybershujaa ID: CS-DA01-25087 Date: 2 February 2026


Overview

This script scrapes hockey team statistics from ScrapeThisSite, parses the HTML table using BeautifulSoup, loads the data into a Pandas DataFrame, and exports it to a CSV file.


Requirements

Make sure you have Python 3 installed, then install the required libraries:

pip install requests beautifulsoup4 pandas

How It Works

  1. Fetch the page – Sends an HTTP GET request to the target URL.
  2. Parse HTML – Uses BeautifulSoup to parse the page's HTML content.
  3. Extract table data – Locates the HTML table, reads the column headers, and iterates over each row to collect the data.
  4. Load into DataFrame – Stores the extracted data in a Pandas DataFrame for easy manipulation and viewing.
  5. Export to CSV – Saves the final DataFrame to hockey_teams_data.csv in the working directory.

Usage

Run the script directly with Python:

python web_scraping.py

On success, you will see the column names and the first few rows printed to the console, and a file named hockey_teams_data.csv will be created in the same directory.


Output

File Description
hockey_teams_data.csv All scraped hockey team records in CSV format

Project Structure

.
├── web_scraping.py       # Main scraping script
├── hockey_teams_data.csv # Output file (generated on run)
└── README.md             # Project documentation

Notes

  • The target site is a sandbox site designed for practicing web scraping, so no special permissions are required.
  • The script skips the header row when extracting table rows to avoid including column names as data.
  • Empty rows are filtered out automatically.

About

Scraping data from a website using python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages