Skip to content

This repository contains a comprehensive analysis of the General Election (Lok Sabha 2024 Elections) data.

License

Notifications You must be signed in to change notification settings

pawan-cpu/GeneralElection-Loksabha-DataAnalysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Indian General Elections'24(LokSabha Elections) Data Analysis through web scraping

This project involves scraping the information of the recently concluded Lok Sabha election from the Election Commission of India's website and building a report of key insights derived from the data. The analysis includes various visualizations to illustrate the findings.

Requirements

  • Python 3.x
  • Libraries:
    • pandas
    • requests
    • BeautifulSoup
    • matplotlib
    • seaborn

Data Scraping

The data was scraped from the Election Commission of India's website using the requests and BeautifulSoup libraries. The scraping process involved extracting the following information:

  1. State-wise Voting Data:

    • State Name
    • Parliament Constituency
    • Winning Candidate
    • Total Votes
    • Margin
    • Party Name
  2. Party-wise Performance:

    • Party Name
    • Won
    • Leading
    • Total Seats

Here is a sample code snippet to scrape the data:

import requests
from bs4 import BeautifulSoup
import pandas as pd

url = 'https://results.eci.gov.in'
response = requests.get(url)
soup = BeautifulSoup(response.content, 'html.parser')

# Extract data (this is an example and might need adjustment based on the actual website structure)
state_data = []
for option in soup.find(id='ctl00_ContentPlaceHolder1_Result1_ddlState').find_all('option'):
    state_data.append(option.text)

# Continue scraping the required details and store them in pandas DataFrame

About

This repository contains a comprehensive analysis of the General Election (Lok Sabha 2024 Elections) data.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published