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.
- 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.
The library implements a minimalist dataframe engine in standard Python:
-
DataFrame: A structure representing a table. It containsdata(a list of row dicts) andcolumns(list of column headers).DataFrame.read_csv(path_or_url): Parses CSVs (local files or over HTTP), auto-casting column values tointorfloatwhere 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 handlingNonevalues.DataFrame.head(n): Returns the topnrows.DataFrame.to_string(max_rows): Pretty prints dataframes as formatted ASCII tables with left-aligned strings and right-aligned numbers.
-
GroupedDataFrame: Returned by.groupby().- Organizes rows into dictionary groups using tuple keys.
- Supports
.agg(agg_dict)which performs operations likesum,count,mean,min,max, or custom callbacks.
- Python 3.6 or later installed.
- No third-party packages (like
pandas) are needed!
- Open your terminal in this directory.
- Run the main CLI:
python main.py
- On the first run, the tool will download the datasets (approx. 30 MB in total). A progress bar will track the download.
- Select queries from the interactive menu!
A suite of unit tests validates the dataframe engine functionalities:
python -m unittest test_pandas_lite.pyTo upload this project to your GitHub account:
- Go to GitHub Dashboard and click New to create a new repository. Name it (e.g.,
ipl-cricket-stats-cli). - 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