Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IPL & Cricket Statistics CLI

A command-line interface (CLI) to query Indian Premier League (IPL) statistics from 2008 to 2022. It downloads public datasets, caches them locally, and lets you query batsmen, bowlers, player of the match awards, team standings, and head-to-head statistics.

This project is built using a custom pure-Python "pandas-lite" data engine, serving as an educational practice of how basic dataframes, joins, groupings, and filters work under the hood without external dependencies like pandas.

Features

  • Top Run Scorers (Orange Cap): Get the leading run scorers for any season or overall.
  • Top Wicket Takers (Purple Cap): Filter top bowlers with calculated metrics like economy rate.
  • Player of the Match Awards: View who has won the most awards for a season or all-time.
  • Team Stats & Standings: Calculate matches played, won, lost, ties, and win percentage.
  • Head-to-Head: Query match records and win percentages between any two teams.
  • Smart Caching: Data is downloaded on the first run, stored in data/, and loaded instantly on subsequent runs.
  • Visual Progress Indicator: Chunked downloads feature a clean progress bar and speed display.

Technical Architecture: pandas_lite.py

The library implements a minimalist dataframe engine in standard Python:

  1. DataFrame: A structure representing a table. It contains data (a list of row dicts) and columns (list of column headers).

    • DataFrame.read_csv(path_or_url): Parses CSVs (local files or over HTTP), auto-casting column values to int or float where appropriate.
    • DataFrame.filter(condition_fn): Filters rows based on a boolean predicate.
    • DataFrame.merge(other, on): Implements a hash join between two datasets on a shared key.
    • DataFrame.sort_values(by, ascending): In-place sorted copies, safely handling None values.
    • DataFrame.head(n): Returns the top n rows.
    • DataFrame.to_string(max_rows): Pretty prints dataframes as formatted ASCII tables with left-aligned strings and right-aligned numbers.
  2. GroupedDataFrame: Returned by .groupby().

    • Organizes rows into dictionary groups using tuple keys.
    • Supports .agg(agg_dict) which performs operations like sum, count, mean, min, max, or custom callbacks.

Setup & Running Instructions

Prerequisites

  • Python 3.6 or later installed.
  • No third-party packages (like pandas) are needed!

Running the App

  1. Open your terminal in this directory.
  2. Run the main CLI:
    python main.py
  3. On the first run, the tool will download the datasets (approx. 30 MB in total). A progress bar will track the download.
  4. Select queries from the interactive menu!

Running Unit Tests

A suite of unit tests validates the dataframe engine functionalities:

python -m unittest test_pandas_lite.py

Publishing to GitHub

To upload this project to your GitHub account:

  1. Go to GitHub Dashboard and click New to create a new repository. Name it (e.g., ipl-cricket-stats-cli).
  2. Run the following commands in your local project terminal:
# Initialize git
git init

# Add all files to staging (except cache files)
# Create a .gitignore file:
echo "data/" > .gitignore
git add .

# Create initial commit
git commit -m "Initial commit: IPL stats CLI with custom pandas-lite engine"

# Rename default branch to main
git branch -M main

# Link to your remote GitHub repository (replace with your actual username and repo name)
git remote add origin https://github.com/YOUR_GITHUB_USERNAME/ipl-cricket-stats-cli.git

# Push code to GitHub
git push -u origin main

About

an ipl stats showing in cli

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages