Skip to content

Ursaravind/IPL_UnitTesting_Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UNIT-TESTING - IPL Analysis Project

This project main aim is to do some analysys on ipl data sets along with unit testing in python This project analyzes IPL (Indian Premier League) match data from 2008 to 2016, generating visualizations based on matches and deliveries datasets. It includes four Python scripts to address specific analysis tasks and along with unit testing .

Overview

  • Data Source: data/matches.csv and data/deliveries.csv contain match and ball-by-ball data.
  • Scripts: Located in src/, each script computes and plots a specific metric:
    • matches_per_year.py: Total matches played per year.
    • wins_per_team.py: Stacked bar chart of matches won by teams per year.
    • extra_runs_2016.py: Extra runs conceded per team in 2016.
    • top_bowlers_2015.py: Top 10 economical bowlers in 2015.
  • Outputs: Plots saved in outputs/ as PNG files.

Prerequisites

  • Python 3.x
  • Required packages: matplotlib

Setup

  1. Clone the Repository:

    git clone <repository-url>
    cd project
  2. Install Dependencies:

    pip install -r requirements.txt
  3. Prepare Data:

    • Place matches.csv and deliveries.csv in the data/ directory.
    • Ensure outputs/ directory exists (create with mkdir outputs if needed).

Usage

Run each script individually to generate plots and view results:

python src/matches_per_year.py    # Q1: Matches per year
python src/wins_per_team.py       # Q2: Wins per team (stacked bar)
python src/extra_runs_2016.py     # Q3: Extra runs in 2016
python src/top_bowlers_2015.py    # Q4: Top 10 economical bowlers in 2015
  • Output plots are saved in outputs/ (e.g., q01_total_ipl_matches_played.png).
  • Console output includes computed data (e.g., dictionaries, lists).

Testing

Each script includes unit tests. Run tests and check coverage:

pip install coverage
coverage run src/matches_per_year.py
coverage run --append src/wins_per_team.py
coverage run --append src/extra_runs_2016.py
coverage run --append src/top_bowlers_2015.py
coverage report -m

Notes

  • Data: Ensure CSV files are complete for accurate results.
  • Dependencies: Only matplotlib is required; no pandas is used.
  • License: [Add license if applicable, e.g., MIT]
  • Last Updated: August 26, 2025, 05:15 PM IST

Contributing

Feel free to fork and submit pull requests. Report issues via the repository.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages