├── .gitignore
├── LICENSE
├── Notebooks
├── EDA_part1.ipynb
├── EDA_part2.ipynb
└── ml_models.ipynb
├── Procfile
├── README.md
├── data
├── Data_Descriptions.md
├── batting.csv
├── batting_all_time.csv
├── bowling.csv
├── bowling_all_time.csv
├── fastest_centuries.csv
├── fastest_fifties.csv
├── points_table.csv
├── series_matches.csv
└── wins_losses.csv
├── images
├── batting_bar.png
├── batting_beeswarm.png
├── batting_bf.png
├── batting_sr.png
├── bowling_bar.png
├── bowling_beeswarm.png
├── bowling_dots.png
└── bowling_sr.png
├── ipl-app.py
├── requirements.txt
├── wallpaper.jpg
└── web_scraping
├── web_scraping_script.py
├── ws_part1.ipynb
└── ws_part2.ipynb
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # Created by https://www.toptal.com/developers/gitignore/api/python,jupyternotebooks,code
3 | # Edit at https://www.toptal.com/developers/gitignore?templates=python,jupyternotebooks,code
4 |
5 | ## Ignore file
6 | dream11.ipynb
7 |
8 | ### Code ###
9 | .vscode/*
10 | !.vscode/settings.json
11 | !.vscode/tasks.json
12 | !.vscode/launch.json
13 | !.vscode/extensions.json
14 | *.code-workspace
15 |
16 | ### JupyterNotebooks ###
17 | # gitignore template for Jupyter Notebooks
18 | # website: http://jupyter.org/
19 |
20 | .ipynb_checkpoints
21 | */.ipynb_checkpoints/*
22 |
23 | # IPython
24 | profile_default/
25 | ipython_config.py
26 |
27 | # Remove previous ipynb_checkpoints
28 | # git rm -r .ipynb_checkpoints/
29 |
30 | ### Python ###
31 | # Byte-compiled / optimized / DLL files
32 | __pycache__/
33 | *.py[cod]
34 | *$py.class
35 |
36 | # C extensions
37 | *.so
38 |
39 | # Distribution / packaging
40 | .Python
41 | build/
42 | develop-eggs/
43 | dist/
44 | downloads/
45 | eggs/
46 | .eggs/
47 | lib/
48 | lib64/
49 | parts/
50 | sdist/
51 | var/
52 | wheels/
53 | pip-wheel-metadata/
54 | share/python-wheels/
55 | *.egg-info/
56 | .installed.cfg
57 | *.egg
58 | MANIFEST
59 |
60 | # PyInstaller
61 | # Usually these files are written by a python script from a template
62 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
63 | *.manifest
64 | *.spec
65 |
66 | # Installer logs
67 | pip-log.txt
68 | pip-delete-this-directory.txt
69 |
70 | # Unit test / coverage reports
71 | htmlcov/
72 | .tox/
73 | .nox/
74 | .coverage
75 | .coverage.*
76 | .cache
77 | nosetests.xml
78 | coverage.xml
79 | *.cover
80 | *.py,cover
81 | .hypothesis/
82 | .pytest_cache/
83 | pytestdebug.log
84 |
85 | # Translations
86 | *.mo
87 | *.pot
88 |
89 | # Django stuff:
90 | *.log
91 | local_settings.py
92 | db.sqlite3
93 | db.sqlite3-journal
94 |
95 | # Flask stuff:
96 | instance/
97 | .webassets-cache
98 |
99 | # Scrapy stuff:
100 | .scrapy
101 |
102 | # Sphinx documentation
103 | docs/_build/
104 | doc/_build/
105 |
106 | # PyBuilder
107 | target/
108 |
109 | # Jupyter Notebook
110 |
111 | # IPython
112 |
113 | # pyenv
114 | .python-version
115 |
116 | # pipenv
117 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
118 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
119 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
120 | # install all needed dependencies.
121 | #Pipfile.lock
122 |
123 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow
124 | __pypackages__/
125 |
126 | # Celery stuff
127 | celerybeat-schedule
128 | celerybeat.pid
129 |
130 | # SageMath parsed files
131 | *.sage.py
132 |
133 | # Environments
134 | .env
135 | .venv
136 | env/
137 | venv/
138 | ENV/
139 | env.bak/
140 | venv.bak/
141 |
142 | # Spyder project settings
143 | .spyderproject
144 | .spyproject
145 |
146 | # Rope project settings
147 | .ropeproject
148 |
149 | # mkdocs documentation
150 | /site
151 |
152 | # mypy
153 | .mypy_cache/
154 | .dmypy.json
155 | dmypy.json
156 |
157 | # Pyre type checker
158 | .pyre/
159 |
160 | # pytype static type analyzer
161 | .pytype/
162 | # virtual environment
163 | ipl_venv/
164 |
165 | # End of https://www.toptal.com/developers/gitignore/api/python,jupyternotebooks,code
166 |
167 |
168 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 bprasad26
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | web: gunicorn ipl-app:server
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Indian Premier League 2008-2019
2 |
3 |
4 | [](https://www.python.org/) [](https://github.com/bprasad26/ipl_data_analysis/blob/master/LICENSE) [](https://www.lifewithdata.com/contact)
5 |
6 | 
7 |
8 |
9 |
10 |
11 | The Indian Premier League is a professional Twenty20 cricket league in India contested during March or April and May of every year by eight teams representing eight different cities in India. The league was founded by the Board of Control for Cricket in India in 2008.
12 |
13 |
14 |
15 | ## Project Website - [IPL Stats](https://bprasad26-ipl-stats.herokuapp.com/)
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | #### Installation
25 |
26 | Start by installing [Python](https://www.python.org/) and [Git](https://git-scm.com/downloads) if you have not already.
27 |
28 |
29 | Next, clone this project by opening a terminal and typing the following commands (do not type the first $ signs on each line, they just indicate that these are terminal commands):
30 |
31 | ```sh
32 | $ git clone https://github.com/bprasad26/ipl_data_analysis.git
33 | $ cd ipl_data_analysis
34 | ```
35 |
36 |
37 | Next, create a virtual environment:
38 |
39 |
40 | ```sh
41 | # create virtual environment
42 | $ python3 -m venv ipl_venv
43 | # Activate the virtual environment
44 | $ source ipl_venv/bin/activate
45 | ```
46 |
47 | Install the required packages
48 | ```sh
49 | # install packages from requirements.txt file
50 | $ pip install -r requirements.txt
51 | ```
52 | Activate and Start jupyter Notebook
53 | ```sh
54 | # activate venv for jupyter notebook
55 | $ python -m ipykernel install --user --name=ipl_venv
56 | # start jupyter notebook
57 | $ jupyter notebook
58 | # Note - at the top change the kernal to ipl_venv from the kernal dropdown if not done automatically.
59 | ```
60 |
61 | deactivate the virtual environment, once done with your work
62 | ```sh
63 | $ deactivate
64 | ```
65 | to stay updated with this project
66 | ```sh
67 | $ git pull
68 | ```
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/data/Data_Descriptions.md:
--------------------------------------------------------------------------------
1 | # Data Descriptions -
2 |
3 | ### 1. Batting.csv
4 |
5 | * Pos - The position of a player in a particular season based on total runs.
6 | * Player - The name of the player.
7 | * Mat - Total matches in which a player was included in the playing 11.
8 | * Inns - The number of innings in which the batsman actually batted.
9 | * NO - The number of times the batsman was not out at the conclusion of an innings they batted in.
10 | * Runs - Total Runs scored in a particular season.
11 | * HS - The highest score ever made by the batsman in the season.
12 | * Avg - Batting Average - The total number of runs divided by the total number of innings in which the batsman was out. Ave = Runs/[I – NO] (also Avge or Avg.).
13 | * BF - Balls Faced - The total number of balls received, including no-balls but not including wides.
14 | * SR - Strike Rate - The average number of runs scored per 100 balls faced. (SR = [100 * Runs]/BF).
15 | * 100 - Number of times 100 runs(centuries) scored by a player.
16 | * 50 - Number of times 50 runs(half-centuries) scored by a player.
17 | * 4s - Number of times a player hits a 4.
18 | * 6s - Number of times a player hits a 6.
19 | * Nationality - Whether the palyed is indian or overseas.
20 | * Team - The team the player belongs to.
21 | * Season - The year the record belongs to.
22 |
23 |
24 | ### Bowling.csv
25 | * Pos - The position of a player in a particular season based on Total wickets.
26 | * Player - The name of the player.
27 | * Mat - Total matches in which a player was included in the playing 11.
28 | * Inns - The number of innings in which the bowler actually bowled.
29 | * Ov - Overs - The number of overs bowled. The notation is (x.y) meaning x overs plus y balls have been bowled.
30 | * Runs - The number of runs conceded by the bowler.
31 | * Wkts - The number of wickets taken.
32 | * BBI - BBI stands for Best Bowling in Innings and only gives the score for one innings. (If only the BB rate is given it's considered the BBI rate).
33 | * Avg - Bowling Average -The average number of runs conceded per wicket. (Ave = Runs/W).
34 | * Econ - Economy rate -The average number of runs conceded per over. (Econ = Runs/Overs bowled).
35 | * SR - The average number of balls bowled per wicket taken. (SR = Balls/W).
36 | * 4w - Four Wickets in an innings. The number of innings in which the bowler took exactly four wickets.
37 | * 5w - Five Wickets in an innings. The number of innings in which the bowler took at least five wickets.
38 | * Nationality - Whether the palyed is indian or overseas.
39 | * Dots - Number of dot balls delivered by the bowler.
40 | * Maid - The number of overs in which the bowler did not concede any runs.
41 | * Season - The year the record belongs to.
42 |
43 |
44 | ### Fastest_Centuries.csv
45 | * Pos - The position of a player in a particular season based on higest runs in that inning.
46 | * Player - The name of the player.
47 | * Against - scored against which team.
48 | * Venue - Where the match was played.
49 | * Match Date - The date of the match.
50 | * BF - Total balls faced to achieve the fastest century.
51 | * 6s - Number of times a player hits a 6.
52 | * 4s - Number of times a player hits a 4.
53 | * Runs - Total runs scored in that match.
54 | * Season - The year the record belongs to.
55 |
56 | ### fastest_fifties.csv
57 | * Pos - The position of a player in a particular season based on higest runs in that inning.
58 | * Player - The name of the player.
59 | * Against - scored against which team.
60 | * Venue - Where the match was played.
61 | * Match Date - The date of the match.
62 | * BF - Total balls faced to achieve the fastest fifty.
63 | * 6s - Number of times a player hits a 6.
64 | * 4s - Number of times a player hits a 4.
65 | * Runs - Total runs scored in that match.
66 | * Season - The year the record belongs to.
67 |
68 | ### Points_table.csv
69 | * Team - The name of the team.
70 | * Mat - Total matches played by the team.
71 | * Won - Total mathes won.
72 | * Lost - Total matches lost.
73 | * Tied - Total matches in which a match tied.
74 | * N/R -
75 | * Points - Total points scored
76 | * Net R/R - Net run rate - A method of ranking teams with equal points in limited overs league competitions.
77 | * For -
78 | * Against -
79 | * Season - The year.
80 |
81 | ### Series_matches.csv
82 | * Date - The date of the match.
83 | * Ground/ Location- Where the match is played.
84 | * Match Number - match serial number
85 | * Team A - Name of the team A
86 | * Team B - Name of the team B
87 | * Winner - Which team won the match.
88 | * Wins_by_runs - Wins by how much runs. In this case, wins_by_wickets will be 0.
89 | * Wins_by_wickets - wins by how much wickets. In this case, wins_by_runs will be 0.\
90 | * Season - The year the match belongs to.
91 |
92 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/data/batting_all_time.csv:
--------------------------------------------------------------------------------
1 | PLAYER,Mat,Inns,NO,Runs,HS,Avg,BF,SR,100,50,4s,6s
2 | Virat Kohli,177,169,26,5412,113,37.64,4112,128.45,5,36,480,190
3 | Suresh Raina,193,189,28,5368,100,34.23,3914,136.83,1,38,493,194
4 | Rohit Sharma,188,183,28,4898,109,31.83,3744,130.86,1,36,431,194
5 | Shikhar Dhawan,164,162,21,4619,97,30.32,3714,118.87,0,37,527,96
6 | David Warner,119,119,17,4543,126,44.5,3173,143.39,4,43,442,176
7 | Chris Gayle,125,124,15,4484,175,39.81,2969,146.0,6,28,369,326
8 | MS Dhoni,190,170,65,4432,84,46.77,3215,137.89,0,23,297,209
9 | Robin Uthappa,177,170,17,4411,87,28.9,3380,130.72,0,24,435,156
10 | Gautam Gambhir,139,137,15,3931,93,31.54,3126,122.81,0,35,459,57
11 | AB de Villiers,139,129,28,3930,133,36.84,2551,146.15,2,30,318,200
12 | Ajinkya Rahane,138,130,16,3816,105,32.65,3116,122.36,2,27,403,74
13 | Shane Watson,134,130,15,3575,117,31.86,2562,136.67,4,19,343,177
14 | Dinesh Karthik,167,150,23,3366,97,27.01,2598,129.33,0,17,337,92
15 | Ambati Rayudu,147,140,25,3300,100,28.36,2620,125.54,1,18,278,120
16 | Yusuf Pathan,174,154,44,3204,100,30.3,2241,138.14,1,13,262,158
17 | Brendon McCullum,108,108,5,2874,158,30.34,2179,136.29,2,13,292,130
18 | Parthiv Patel,139,137,11,2848,81,22.32,2358,119.01,0,13,365,49
19 | Manish Pandey,127,118,23,2840,114,34.16,2344,121.67,1,15,253,75
20 | Kieron Pollard,148,135,39,2755,83,28.54,1877,145.44,0,14,181,176
21 | Yuvraj Singh,132,126,15,2750,83,24.5,2120,128.2,0,13,217,149
22 | Murali Vijay,102,102,5,2575,127,25.99,2096,117.4,2,13,243,90
23 | Virender Sehwag,93,93,4,2530,122,27.79,1617,153.52,2,15,310,99
24 | Shaun Marsh,71,69,7,2477,115,38.61,1866,131.62,1,20,266,78
25 | Jacques Kallis,98,96,11,2427,89,28.61,2222,109.36,0,17,255,44
26 | Dwayne Smith,91,89,5,2385,87,26.19,1764,133.46,0,17,245,117
27 | Sachin Tendulkar,78,78,11,2334,100,34.33,1948,118.5,1,13,295,29
28 | Sanju Samson,93,89,9,2209,102,27.42,1696,129.33,2,10,170,89
29 | Rahul Dravid,89,82,5,2174,75,28.17,1882,116.85,0,11,269,28
30 | Adam Gilchrist,80,80,4,2069,109,28.13,1495,137.35,2,11,239,92
31 | JP Duminy,83,77,26,2029,78,42.68,1636,119.85,0,14,126,79
32 | Steve Smith,81,72,18,2022,101,38.22,1568,130.51,1,8,180,49
33 | Michael Hussey,59,58,7,1977,116,38.71,1612,119.41,1,15,198,52
34 | KL Rahul,62,56,11,1957,100,40.41,1415,130.84,1,16,172,81
35 | Ravindra Jadeja,170,128,48,1927,48,25.5,1572,124.25,0,0,135,65
36 | David Miller,79,77,23,1850,101,34.6,1333,131.34,1,9,126,87
37 | Faf du Plessis,69,63,5,1845,96,32.11,1455,126.82,0,12,162,59
38 | Mahela Jayawardene,80,78,15,1802,110,29.82,1462,125.2,1,10,200,39
39 | Wriddhiman Saha,116,94,21,1759,115,27.45,1332,134.06,1,6,160,59
40 | Rishabh Pant,54,54,6,1736,128,35.26,1067,158.03,1,11,152,94
41 | Aaron Finch,74,72,7,1716,88,23.56,1308,120.56,0,13,176,66
42 | Kumar Sangakkara,71,68,3,1687,94,25.75,1392,120.35,0,10,195,27
43 | Manoj Tiwary,96,84,26,1686,75,28.31,1436,116.1,0,7,155,40
44 | Shreyas Iyer,62,62,7,1681,96,28.16,1324,117.95,0,13,149,67
45 | Suryakumar Yadav,84,70,16,1548,72,27.25,1169,132.11,0,7,161,47
46 | Naman Ojha,110,91,18,1544,94,22.08,1299,117.44,0,6,120,79
47 | Mandeep Singh,93,82,15,1525,77,21.8,1215,123.25,0,5,159,33
48 | Dwayne Bravo,128,100,37,1472,70,21.24,1150,140.53,0,5,115,60
49 | Karun Nair,66,60,4,1450,83,26.37,1121,129.56,0,10,158,39
50 | Quinton de Kock,47,47,2,1450,108,31.99,1094,133.84,1,10,154,54
51 | Subramaniam Badrinath,95,67,20,1441,71,31.05,1212,118.39,0,11,154,28
52 | Glenn Maxwell,67,66,6,1391,95,21.77,856,151.48,0,6,109,91
53 | Brad Hodge,63,60,21,1388,73,34.51,1101,127.2,0,6,120,43
54 | Andre Russell,59,48,10,1387,88,34.39,729,185.63,0,8,96,120
55 | Jos Buttler,45,45,6,1386,95,36.01,919,149.8,0,9,140,61
56 | Sourav Ganguly,59,56,3,1349,91,25.41,1263,101.25,0,7,137,42
57 | David Hussey,64,61,12,1322,71,28.88,1075,123.69,0,5,90,60
58 | Kane Williamson,41,41,7,1302,89,33.82,964,126.07,0,12,111,44
59 | Saurabh Tiwary,81,64,19,1276,61,22.97,1067,118.87,0,7,93,45
60 | Chris Lynn,40,40,3,1274,93,33.41,901,136.57,0,10,127,63
61 | Mayank Agarwal,77,72,3,1266,68,16.36,988,120.94,0,5,117,52
62 | Irfan Pathan,98,78,29,1126,60,23.58,930,118.43,0,1,87,37
63 | Matthew Hayden,32,32,2,1107,93,45.54,805,137.7,0,8,121,44
64 | Nitish Rana,46,41,4,1085,85,30.68,806,135.55,0,8,84,60
65 | Lendl Simmons,28,28,2,1071,100,40.28,844,126.72,1,11,109,43
66 | Hardik Pandya,66,61,24,1068,91,27.59,690,146.3,0,3,72,68
67 | Kedar Jadhav,73,66,22,1061,69,17.59,830,127.57,0,4,91,38
68 | Ross Taylor,55,54,14,1017,81,25.5,822,121.86,0,3,66,46
69 | Manan Vohra,49,45,2,1012,95,22.42,768,126.97,0,3,97,39
70 | Kevin Pietersen,36,36,9,1001,103,40.28,743,130.58,1,4,91,40
71 | Venugopal Rao,64,54,10,985,71,21.57,836,110.4,0,3,77,37
72 | Albie Morkel,91,68,28,974,73,28.23,686,141.59,0,3,61,55
73 | Andrew Symonds,39,36,9,974,117,45.12,750,131.74,1,5,74,41
74 | Moises Henriques,56,49,16,958,74,27.84,751,113.15,0,5,85,27
75 | Cameron White,47,45,9,954,78,25.45,755,122.34,0,6,76,36
76 | Krunal Pandya,55,48,14,891,86,28.41,610,148.52,0,1,86,35
77 | Herschelle Gibbs,36,36,4,886,69,29.87,807,106.72,0,6,83,31
78 | Stuart Binny,94,67,23,872,48,21.29,678,129.63,0,0,65,35
79 | Eoin Morgan,52,45,5,854,66,19.83,705,117.91,0,4,72,34
80 | Harbhajan Singh,149,87,35,828,64,17.09,597,135.53,0,1,79,42
81 | Axar Patel,82,63,21,796,44,18.18,630,124.49,0,0,47,35
82 | Manvinder Bisla,38,38,1,795,92,20.95,693,113.57,0,4,93,23
83 | Sanath Jayasuriya,30,30,2,772,114,23.27,532,129.73,1,4,85,39
84 | Rahul Tripathi,34,33,4,758,93,25.51,552,133.75,0,4,74,27
85 | Shakib Al Hasan,62,45,10,745,66,18.23,588,122.33,0,2,70,20
86 | Graeme Smith,29,29,3,739,91,25.19,668,103.78,0,4,94,9
87 | Tillakaratne Dilshan,38,37,4,735,76,20.75,666,106.22,0,5,98,11
88 | Sunil Narine,60,44,5,734,75,15.6,418,149.97,0,3,91,42
89 | Angelo Mathews,49,42,11,724,65,21.43,575,124.67,0,1,44,29
90 | Ishan Kishan,37,33,0,695,62,18.96,531,121.84,0,3,64,34
91 | Abhishek Nayar,60,50,12,672,45,17.89,577,107.82,0,0,55,20
92 | Tirumalasetti Suman,41,38,8,661,78,19.76,556,115.32,0,2,54,25
93 | George Bailey,39,36,10,645,61,23.9,517,118.16,0,2,57,19
94 | Ben Stokes,34,33,5,635,103,22.81,481,129.65,1,1,43,25
95 | Jesse Ryder,29,29,1,604,86,19.75,458,127.75,0,4,69,19
96 | Prithvi Shaw,25,25,0,598,99,24.64,424,143.42,0,4,72,19
97 | Piyush Chawla,151,80,32,582,24,12.24,518,112.43,0,0,54,18
98 | Hashim Amla,16,16,3,577,104,43.08,407,138.88,2,3,60,21
99 | Vijay Shankar,32,29,11,557,63,41.28,416,134.77,0,2,34,24
100 | Corey Anderson,30,29,7,538,95,23.34,423,114.16,0,3,40,31
101 | Ravi Bopara,24,22,4,531,84,29.2,453,117.56,0,3,39,16
102 | Deepak Hooda,61,45,9,524,54,17.09,412,127.38,0,1,27,24
103 | James Faulkner,57,43,19,513,46,22.76,376,129.98,0,0,36,23
104 | Chris Morris,45,33,16,503,82,37.03,312,154.26,0,2,37,27
105 | Shubman Gill,27,24,9,499,76,33.36,377,135.2,0,4,43,15
106 | Paul Valthaty,20,20,1,493,120,20.3,389,97.9,1,2,60,20
107 | Marcus Stoinis,29,25,10,473,52,29.92,364,117.88,0,1,34,18
108 | Owais Shah,18,18,7,455,76,47.64,351,126.93,0,4,31,21
109 | Jonny Bairstow,10,10,2,445,114,55.62,283,157.24,1,2,48,18
110 | Gurkeerat Mann Singh,31,27,3,440,65,20.88,342,128.04,0,2,47,11
111 | Dan Christian,38,32,9,440,39,18.77,359,120.59,0,0,22,19
112 | Evin Lewis,16,16,0,430,65,22.69,328,115.35,0,2,36,26
113 | Mithun Manhas,41,30,10,426,42,24.54,391,118.8,0,0,35,9
114 | James Hopes,21,19,3,417,71,29.65,306,136.68,0,4,49,11
115 | Johan Botha,34,28,8,409,67,20.3,359,126.08,0,1,39,5
116 | Swapnil Asnodkar,17,17,0,409,60,23.4,326,119.42,0,2,54,10
117 | Sarfaraz Khan,33,23,8,408,67,28.99,286,154.87,0,1,45,11
118 | Ashok Menaria,28,22,2,400,40,20.0,354,113.66,0,0,24,18
119 | Thisara Perera,30,26,7,395,40,16.91,271,128.08,0,0,19,26
120 | Laxmi Ratan Shukla,42,31,7,388,48,15.56,328,116.57,0,0,31,16
121 | Azhar Mahmood,22,20,2,382,80,21.42,296,129.12,0,2,38,13
122 | Mark Boucher,22,19,7,375,50,31.07,293,128.21,0,1,32,12
123 | Cheteshwar Pujara,27,19,3,373,51,22.46,369,102.37,0,1,49,3
124 | Sunny Sohal,19,18,0,364,62,19.63,284,127.01,0,2,34,18
125 | Pawan Negi,45,33,9,362,36,16.25,284,116.87,0,0,27,16
126 | Dwaraka Ravi Teja,28,21,5,357,60,21.99,296,117.62,0,1,34,9
127 | Ravichandran Ashwin,102,44,15,347,45,12.89,303,115.78,0,0,29,10
128 | Sam Billings,21,18,0,334,56,19.5,246,136.22,0,3,31,10
129 | Praveen Kumar,98,52,18,331,34,9.34,296,107.36,0,0,23,17
130 | Aditya Tare,32,26,4,331,59,13.17,258,114.9,0,1,39,11
131 | Amit Mishra,87,42,19,329,31,17.44,334,101.11,0,0,28,5
132 | James Franklin,20,16,5,327,79,38.97,301,117.91,0,1,25,8
133 | Karn Sharma,55,33,13,316,39,11.45,271,121.1,0,0,18,14
134 | Rajat Bhatia,71,37,16,309,26,16.65,243,128.84,0,0,20,13
135 | Ryan ten Doeschate,26,19,7,305,70,28.79,214,143.65,0,1,25,14
136 | Debabrata Das,31,22,8,304,35,24.72,261,115.47,0,0,23,16
137 | Colin de Grandhomme,25,21,5,303,40,19.09,225,128.92,0,0,18,18
138 | Luke Pomersbach,17,16,5,302,79,51.0,246,116.56,0,1,25,13
139 | Vinay Kumar,80,38,13,300,26,18.49,263,112.61,0,0,20,9
140 | Moeen Ali,16,14,2,297,66,23.38,179,166.4,0,3,20,23
141 | Unmukt Chand,17,16,0,296,58,18.65,275,109.59,0,1,32,9
142 | Darren Sammy,22,20,5,295,60,16.97,241,107.57,0,1,15,18
143 | Shreevats Goswami,28,18,1,285,52,18.44,281,103.56,0,1,30,3
144 | VVS Laxman,20,20,2,282,52,15.57,267,96.6,0,1,33,5
145 | Ashish Reddy,31,24,9,280,36,19.35,193,145.47,0,0,16,15
146 | Hanuma Vihari,22,21,3,280,46,13.48,313,99.06,0,0,23,1
147 | Michael Lumb,11,11,0,278,83,25.27,192,144.79,0,1,45,6
148 | Martin Guptill,13,13,1,270,50,22.67,196,135.49,0,1,24,15
149 | Yogesh Nagar,24,18,6,263,43,23.12,233,112.64,0,0,19,9
150 | Rajagopal Sathish,25,22,7,245,27,15.27,197,119.4,0,0,21,6
151 | Mohammad Kaif,28,21,4,245,34,13.0,234,106.83,0,0,21,6
152 | Bharat Chipli,19,17,6,244,61,19.1,205,113.74,0,1,24,6
153 | Simon Katich,11,11,1,241,75,56.06,186,131.53,0,2,26,8
154 | Ben Cutting,21,17,6,238,39,19.8,141,158.41,0,0,15,19
155 | Mohnish Mishra,17,16,1,233,41,15.92,204,113.46,0,0,23,8
156 | Mitchell Marsh,17,13,2,218,38,19.67,185,109.15,0,0,9,14
157 | Travis Head,10,10,3,205,75,28.6,148,137.4,0,1,12,8
158 | Paul Collingwood,8,7,2,203,75,40.6,156,130.12,0,3,9,13
159 | Karan Goel,16,15,1,200,38,14.08,211,95.33,0,0,16,8
160 | Stephen Fleming,10,10,1,196,45,21.77,164,119.51,0,0,27,3
161 | Abhishek Raut,22,16,7,194,36,22.5,167,115.99,0,0,13,7
162 | Salman Butt,7,7,0,193,73,27.57,161,119.87,0,1,30,2
163 | Ben Rohrer,8,8,2,193,64,32.16,140,137.85,0,1,21,5
164 | Colin Ingram,12,12,2,184,47,18.4,154,119.48,0,0,20,5
165 | Abhishek Jhunjhunwala,13,11,2,183,53,20.33,166,110.24,0,1,16,4
166 | Adam Voges,9,7,3,181,45,45.25,143,126.57,0,0,15,3
167 | Jason Roy,8,8,2,179,91,29.75,134,137.57,0,1,18,8
168 | Shane Warne,28,18,5,178,34,13.75,175,105.87,0,0,13,6
169 | Bhuvneshwar Kumar,85,38,16,177,24,9.24,183,107.81,0,0,17,3
170 | Colin Munro,13,12,0,177,40,14.53,141,124.55,0,0,19,8
171 | Carlos Brathwaite,14,12,1,169,43,14.78,96,161.56,0,0,8,16
172 | Nicholas Pooran,7,6,0,168,48,28.0,107,157.0,0,0,10,14
173 | Chidhambaram Gautam,12,12,3,165,33,19.64,145,119.2,0,0,17,6
174 | Faiz Fazal,10,9,1,164,45,20.5,154,106.49,0,0,19,1
175 | Akshath Reddy,12,10,0,164,42,18.66,160,106.9,0,0,15,2
176 | Mitchell Johnson,51,27,16,162,16,7.23,150,113.91,0,0,10,7
177 | Riyan Parag,7,5,0,160,50,32.0,126,126.98,0,1,17,5
178 | Ajit Agarkar,27,17,9,160,39,27.93,132,123.7,0,0,12,5
179 | MF Maharoof,17,12,3,156,39,15.58,102,146.5,0,0,12,9
180 | Ryan McLaren,16,11,5,156,51,26.0,165,94.7,0,1,14,1
181 | Bipul Sharma,19,11,5,154,35,26.83,96,162.12,0,0,9,9
182 | Marlon Samuels,13,12,1,153,46,12.48,154,97.18,0,0,8,7
183 | Alex Hales,6,6,0,148,45,24.66,118,125.42,0,0,13,6
184 | Shaun Pollock,13,8,0,147,33,18.37,111,132.43,0,0,12,8
185 | Vidyut Sivaramakrishnan,9,8,0,145,54,18.12,109,133.02,0,1,21,3
186 | Krishnappa Gowtham,22,17,5,144,33,10.0,83,145.8,0,0,10,10
187 | Nitin Saini,10,10,0,140,50,14.0,141,99.29,0,1,16,0
188 | Sachin Baby,14,9,1,134,33,14.4,94,125.32,0,0,11,5
189 | Mohammad Nabi,10,9,1,133,31,14.08,88,150.66,0,0,11,7
190 | Rishi Dhawan,20,13,9,132,25,19.67,114,150.58,0,0,10,4
191 | Dale Steyn,49,20,10,131,19,15.71,110,122.13,0,0,12,2
192 | Wasim Jaffer,8,8,0,130,50,13.33,121,99.4,0,1,14,3
193 | Kamran Akmal,6,6,1,128,53,25.6,78,164.1,0,1,13,8
194 | Usman Khawaja,6,6,0,127,30,21.16,100,127.0,0,0,14,3
195 | Scott Styris,10,9,2,126,36,16.33,131,133.02,0,0,9,3
196 | Manpreet Juneja,7,7,0,125,49,17.85,128,97.65,0,0,11,1
197 | Dishant Yagnik,12,9,1,125,34,15.62,96,130.2,0,0,17,2
198 | Shreyas Gopal,29,12,4,124,24,14.47,101,119.35,0,0,14,1
199 | Biplap Samantray,8,7,2,123,55,24.6,111,110.81,0,1,13,2
200 | David Wiese,14,7,3,122,47,30.5,86,141.86,0,0,12,4
201 | Roelof van der Merwe,10,8,0,122,35,15.25,98,124.48,0,0,8,8
202 | Niraj Patel,9,6,2,121,57,30.25,119,87.26,0,1,14,1
203 | Aiden Blizzard,6,6,0,120,51,20.0,87,137.93,0,1,21,2
204 | Misbah-ul-Haq,8,8,1,117,47,16.71,81,144.44,0,0,10,6
205 | Kevon Cooper,25,14,5,116,32,13.92,68,172.42,0,0,9,8
206 | D'Arcy Short,7,7,0,115,44,16.42,99,116.16,0,0,11,5
207 | Andrew McDonald,8,6,4,112,33,11.75,87,129.64,0,0,9,4
208 | Mohit Sharma,44,19,6,111,21,8.61,94,126.87,0,0,7,4
209 | Rahul Tewatia,19,12,6,111,24,19.42,89,132.56,0,0,11,3
210 | Daniel Harris,4,4,0,111,47,27.75,101,109.9,0,0,11,5
211 | Paras Dogra,9,8,0,107,41,13.37,106,100.94,0,0,4,5
212 | Luke Wright,6,6,1,106,44,21.2,60,176.66,0,0,16,3
213 | Tim Southee,29,12,6,104,36,12.25,83,128.84,0,0,7,3
214 | Yogesh Takawale,5,5,0,104,45,20.8,91,114.28,0,0,17,1
215 | Rob Quiney,7,7,0,103,51,14.71,102,100.98,0,1,12,3
216 | Michael Clarke,6,6,0,98,41,16.33,93,105.37,0,0,12,0
217 | Callum Ferguson,9,8,2,98,23,18.25,117,84.12,0,0,9,0
218 | Morne Morkel,21,11,4,97,23,15.7,54,178.28,0,0,9,5
219 | Ryan Harris,29,17,7,97,17,12.82,96,103.84,0,0,5,2
220 | Mitchell Starc,27,12,5,96,29,12.58,98,89.88,0,0,10,0
221 | Sam Curran,9,8,4,95,55,23.75,55,172.72,0,1,13,3
222 | Rashid Khan,32,15,5,93,34,9.3,54,169.07,0,0,5,8
223 | Manpreet Gony,31,13,6,93,42,17.58,55,172.63,0,0,6,8
224 | Harshal Patel,23,12,4,92,36,23.43,52,175.28,0,0,2,9
225 | Umesh Yadav,39,19,15,92,24,26.5,77,135.71,0,0,11,3
226 | Davy Jacobs,6,6,0,92,32,15.33,88,104.54,0,0,10,4
227 | Ricky Ponting,10,9,0,91,28,10.07,128,71.46,0,0,5,2
228 | Shimron Hetmyer,5,5,0,90,75,18.0,73,123.28,0,1,4,7
229 | Jacob Oram,11,8,2,88,41,14.66,93,94.62,0,0,5,4
230 | Anustup Majumdar,4,4,0,87,31,21.75,76,114.47,0,0,7,2
231 | Pinal Shah,14,9,2,87,29,13.08,86,100.53,0,0,8,2
232 | Andrew Tye,20,11,3,85,25,15.92,68,130.44,0,0,6,4
233 | Richard Levi,6,6,0,83,50,13.83,73,113.69,0,1,10,4
234 | Srikkanth Anirudha,9,5,1,83,64,20.75,74,112.16,0,1,6,3
235 | Jofra Archer,21,13,6,82,27,18.25,61,119.46,0,0,6,4
236 | Akshdeep Nath,12,8,0,81,24,9.43,84,90.54,0,0,6,2
237 | Lee Carseldine,5,5,1,81,39,20.25,68,119.11,0,0,11,0
238 | Shahid Afridi,10,9,1,81,33,10.12,46,176.08,0,0,7,6
239 | Pat Cummins,12,9,4,77,24,15.4,53,145.28,0,0,5,4
240 | Travis Birt,5,5,0,75,27,15.0,58,129.31,0,0,9,2
241 | Mitchell McClenaghan,45,19,8,74,20,8.0,60,134.97,0,0,4,6
242 | Ramnaresh Sarwan,4,4,0,73,31,18.25,75,97.33,0,0,6,1
243 | Sachin Rana,9,7,4,73,19,24.33,65,112.3,0,0,7,1
244 | Michael Klinger,4,4,0,73,29,18.25,77,94.8,0,0,9,0
245 | Murali Kartik,26,7,2,73,21,7.0,69,105.37,0,0,5,0
246 | Sherfane Rutherford,7,7,2,73,28,14.6,54,135.18,0,0,2,7
247 | Liam Livingstone,4,4,1,71,44,23.66,48,147.91,0,0,6,5
248 | Brett Lee,15,7,3,70,25,17.5,54,146.18,0,0,4,5
249 | Kagiso Rabada,18,7,1,69,44,11.5,79,89.63,0,0,5,2
250 | Azhar Bilakhia,6,6,2,67,22,16.75,81,82.71,0,0,5,0
251 | Rinku Singh,9,7,1,66,30,12.88,65,101.18,0,0,5,2
252 | Siddharth Chitnis,6,4,1,66,38,22.0,62,106.45,0,0,7,1
253 | Zaheer Khan,31,16,10,66,23,13.5,63,125.98,0,0,7,2
254 | Washington Sundar,7,6,3,65,35,21.66,38,171.05,0,0,5,4
255 | Daniel Vettori,12,9,4,64,20,20.38,53,120.72,0,0,7,1
256 | Deepak Chahar,15,5,1,64,39,15.33,35,202.87,0,0,1,6
257 | Anirudh Singh,5,4,0,63,40,15.75,66,95.45,0,0,6,1
258 | Chris Woakes,18,11,5,63,18,10.0,66,93.67,0,0,5,2
259 | Balachandra Akhil,13,10,5,63,27,11.92,46,130.85,0,0,5,4
260 | Abhishek Sharma,3,3,2,63,46,63.0,33,190.9,0,0,3,5
261 | Andrew Flintoff,3,3,1,62,24,31.0,53,116.98,0,0,5,2
262 | Ishank Jaggi,4,4,1,61,28,23.5,76,80.14,0,0,6,0
263 | Chaminda Vaas,8,7,2,60,20,18.75,55,115.54,0,0,2,2
264 | Ankit Sharma,4,3,0,59,30,21.0,45,140.0,0,0,6,2
265 | Dhawal Kulkarni,22,7,5,58,28,5.75,40,146.67,0,0,3,2
266 | Iqbal Abdulla,13,4,2,57,33,5.0,45,124.07,0,0,8,1
267 | Heinrich Klaasen,4,4,1,57,32,19.0,47,121.27,0,0,5,1
268 | Wilkin Mota,12,8,2,56,25,16.0,75,79.4,0,0,2,0
269 | Lasith Malinga,14,6,0,55,17,9.16,53,103.77,0,0,4,3
270 | Aakash Chopra,7,6,0,53,24,9.7,71,69.32,0,0,7,0
271 | Rilee Rossouw,5,5,0,53,24,10.0,51,117.56,0,0,3,3
272 | Shoaib Malik,7,5,1,52,24,13.0,47,110.63,0,0,5,0
273 | Ramesh Powar,14,5,4,51,28,11.5,43,118.94,0,0,6,1
274 | Ravi Rampaul,12,7,2,51,23,11.25,50,101.35,0,0,3,2
275 | Mahesh Rawat,16,10,6,50,23,4.25,58,85.69,0,0,4,1
276 | Amit Paunikar,4,4,0,49,20,12.25,57,85.96,0,0,9,0
277 | Jaydev Unadkat,15,7,3,49,26,12.25,38,128.94,0,0,6,1
278 | Arjun Yadav,8,6,1,49,16,9.8,39,125.64,0,0,5,2
279 | Jagadeesha Suchith,13,6,5,48,34,48.0,32,150.0,0,0,4,2
280 | Yashpal Singh,8,4,0,47,20,11.75,66,71.21,0,0,5,0
281 | Sanjay Bangar,11,7,1,47,17,7.83,49,95.91,0,0,1,3
282 | Raiphi Gomez,11,8,3,46,26,9.2,50,92.0,0,0,4,1
283 | Sunny Singh,6,5,1,43,20,10.75,31,138.7,0,0,6,1
284 | Adrian Barath,3,3,1,42,33,21.0,42,100.0,0,0,5,1
285 | Jimmy Neesham,4,3,0,42,22,14.0,46,91.3,0,0,3,1
286 | Ishant Sharma,35,9,5,42,10,5.33,29,193.16,0,0,3,3
287 | Arun Karthik,12,5,2,41,19,13.66,38,107.89,0,0,3,1
288 | Shivam Dube,4,4,1,40,24,13.33,33,121.21,0,0,1,3
289 | LPC Silva,3,3,1,40,23,20.0,26,153.84,0,0,5,1
290 | Ben Dunk,3,3,0,40,20,13.33,35,114.28,0,0,7,0
291 | Dimitri Mascarenhas,5,4,0,39,27,9.75,39,100.0,0,0,4,0
292 | Dominic Thornely,6,4,2,39,30,19.5,53,73.58,0,0,2,2
293 | Umar Gul,6,4,1,39,24,13.0,19,205.26,0,0,1,5
294 | Jason Holder,5,5,0,38,16,10.75,31,124.56,0,0,4,2
295 | Sheldon Jackson,4,3,1,38,16,19.0,31,122.58,0,0,5,0
296 | Wayne Parnell,8,5,2,37,16,12.33,39,94.87,0,0,2,1
297 | Mohammad Shami,8,6,2,36,21,9.0,24,150.0,0,0,4,2
298 | Sohail Tanvir,11,5,2,36,13,12.0,29,124.13,0,0,3,1
299 | Bodapati Sumanth,5,4,3,35,16,35.0,37,94.59,0,0,3,0
300 | Varun Aaron,10,3,3,35,17,0.0,34,102.94,0,0,2,1
301 | Aditya Dole,3,2,0,34,30,17.0,22,154.54,0,0,3,1
302 | Nathan Coulter-Nile,19,8,1,34,6,4.83,30,113.88,0,0,2,3
303 | Luke Ronchi,4,4,0,34,13,8.5,32,106.25,0,0,6,1
304 | Dinesh Salunkhe,6,3,1,33,26,16.5,24,137.5,0,0,5,0
305 | Asad Pathan,6,5,1,33,14,8.25,16,206.25,0,0,5,2
306 | Munaf Patel,11,5,2,33,23,11.0,26,126.92,0,0,5,0
307 | Anureet Singh,15,7,3,33,15,10.5,43,91.53,0,0,2,1
308 | Sreenath Aravind,10,8,4,32,9,8.0,40,80.0,0,0,2,0
309 | Kuldeep Yadav,21,6,2,32,16,8.0,30,120.45,0,0,3,0
310 | Robin Peterson,5,5,2,32,16,10.66,30,106.66,0,0,3,1
311 | Mitchell Santner,4,2,1,32,22,32.0,23,139.13,0,0,0,3
312 | Tatenda Taibu,3,3,0,31,15,10.33,26,119.23,0,0,3,0
313 | Shardul Thakur,23,4,2,29,15,3.5,12,250.0,0,0,4,1
314 | Vijay Zol,3,2,0,29,16,14.5,26,111.53,0,0,3,1
315 | Rahul Sharma,6,4,1,29,14,9.66,26,111.53,0,0,3,1
316 | Basil Thampi,12,5,5,28,13,0.0,28,100.0,0,0,1,1
317 | Sridharan Sriram,1,1,0,27,27,27.0,29,93.1,0,0,3,0
318 | Shanthakumaran Sreesanth,6,3,3,27,15,0.0,21,128.57,0,0,5,0
319 | RP Singh,14,9,5,27,10,6.75,24,112.5,0,0,2,1
320 | Abhimanyu Mithun,12,6,3,27,11,9.0,20,135.0,0,0,3,1
321 | JM Kemp,5,2,0,26,22,13.0,24,108.33,0,0,1,1
322 | Mohammed Siraj,11,4,2,25,14,12.5,22,113.63,0,0,2,1
323 | Aniket Choudhary,5,3,2,25,15,25.0,20,125.0,0,0,1,1
324 | Shivnarine Chanderpaul,3,3,0,25,16,8.33,31,80.64,0,0,4,0
325 | Musavir Khote,4,3,1,24,9,12.0,22,109.09,0,0,2,1
326 | Eklavya Dwivedi,4,2,0,24,19,12.0,14,171.42,0,0,2,2
327 | Tom Curran,5,4,1,23,18,7.66,28,82.14,0,0,3,0
328 | Nikhil Naik,2,2,0,23,22,11.5,31,74.19,0,0,1,0
329 | Ashish Nehra,4,2,1,23,22,23.0,20,115.0,0,0,2,1
330 | Jagadeesh Arunkumar,3,3,0,23,22,7.66,23,100.0,0,0,5,0
331 | Mayank Markande,14,6,4,21,7,10.5,24,87.5,0,0,2,0
332 | Harpreet Brar,2,1,1,20,20,0.0,12,166.66,0,0,2,1
333 | Shadab Jakati,9,2,1,20,13,20.0,15,133.33,0,0,3,0
334 | Joginder Sharma,4,2,1,20,16,20.0,18,111.11,0,0,0,1
335 | Mahipal Lomror,2,2,1,20,11,20.0,21,95.23,0,0,1,0
336 | Pradeep Sahu,5,2,1,19,18,19.0,13,146.15,0,0,1,1
337 | Prayas Ray Barman,1,1,0,19,19,19.0,24,79.16,0,0,2,0
338 | Vishnu Vinod,3,3,0,19,9,6.33,26,73.07,0,0,1,1
339 | Rajesh Bishnoi,3,3,0,19,18,6.33,17,111.76,0,0,1,2
340 | Rahul Shukla,3,3,2,18,14,18.0,21,85.71,0,0,2,0
341 | Keemo Paul,8,6,1,18,7,3.6,24,75.0,0,0,1,1
342 | Anil Kumble,16,7,6,16,7,16.0,19,84.21,0,0,2,0
343 | Nic Maddinson,2,2,0,16,12,8.0,14,114.28,0,0,3,0
344 | Jasprit Bumrah,16,2,1,16,16,16.0,12,133.33,0,0,0,1
345 | Simran Singh,1,1,0,16,16,16.0,17,94.11,0,0,1,1
346 | Graham Napier,1,1,0,15,15,15.0,16,93.75,0,0,1,0
347 | Alzarri Joseph,3,2,2,15,15,0.0,13,115.38,0,0,2,0
348 | Sean Abbott,2,2,0,15,14,7.5,13,115.38,0,0,1,1
349 | Siddhesh Lad,1,1,0,15,15,15.0,13,115.38,0,0,1,1
350 | Farhaan Behardien,3,3,1,14,9,7.0,13,107.69,0,0,2,0
351 | Shivam Mavi,9,4,1,13,7,4.33,15,86.66,0,0,1,0
352 | Rahul Chahar,13,4,2,12,10,6.0,11,109.09,0,0,2,0
353 | Rohan Raje,4,2,1,12,11,12.0,9,133.33,0,0,0,1
354 | Karanveer Singh,4,3,2,11,5,11.0,16,68.75,0,0,1,0
355 | Tyron Henderson,2,2,0,11,11,5.5,16,68.75,0,0,0,1
356 | Abu Nechim,3,3,2,10,5,10.0,5,200.0,0,0,2,0
357 | Imran Tahir,6,2,0,8,4,4.0,10,80.0,0,0,2,0
358 |
--------------------------------------------------------------------------------
/data/bowling_all_time.csv:
--------------------------------------------------------------------------------
1 | POS,PLAYER,Mat,Inns,Ov,Runs,Wkts,BBI,Avg,Econ,SR,4w,5w,Nationality,Player Link,Team
2 | 1,Lasith Malinga,122,122,471.1,3366,170,5/13,19.8,7.14,16.62,6,1,Overseas,https://www.iplt20.com/teams/mumbai-indians/squad/211/lasith-malinga,Mumbai Indians
3 | 2,Amit Mishra,149,149,524.5,3857,159,5/17,24.25,7.34,19.8,3,1,Indian,https://www.iplt20.com/teams/delhi-capitals/squad/30/amit-mishra,Delhi Capitals
4 | 3,Piyush Chawla,160,159,532.4,4181,154,4/17,27.14,7.84,20.75,2,0,Indian,https://www.iplt20.com/teams/chennai-super-kings/squad/76/piyush-chawla,Chennai Super Kings
5 | 4,Harbhajan Singh,160,157,562.2,3967,150,5/18,26.44,7.05,22.49,1,1,Indian,https://www.iplt20.com/teams/chennai-super-kings/squad/103/harbhajan-singh,Chennai Super Kings
6 | 5,Dwayne Bravo,134,131,431.0,3617,147,4/22,24.6,8.39,17.59,2,0,Overseas,https://www.iplt20.com/teams/chennai-super-kings/squad/25/dwayne-bravo,Chennai Super Kings
7 | 6,Bhuvneshwar Kumar,120,120,446.2,3233,135,5/19,23.94,7.24,19.83,2,1,Indian,https://www.iplt20.com/teams/sunrisers-hyderabad/squad/116/bhuvneshwar-kumar,Sunrisers Hyderabad
8 | 7,Ravichandran Ashwin,140,137,488.2,3312,127,4/34,26.07,6.78,23.07,1,0,Indian,https://www.iplt20.com/teams/delhi-capitals/squad/8/ravichandran-ashwin,Delhi Capitals
9 | 8,Sunil Narine,112,111,434.2,2898,123,5/19,23.56,6.67,21.18,6,1,Overseas,https://www.iplt20.com/teams/kolkata-knight-riders/squad/203/sunil-narine,Kolkata Knight Riders
10 | 9,Umesh Yadav,121,120,420.2,3579,119,4/24,30.07,8.51,21.19,2,0,Indian,https://www.iplt20.com/teams/royal-challengers-bangalore/squad/59/umesh-yadav,Royal Challengers Bangalore
11 | 10,Ravindra Jadeja,173,145,427.5,3278,110,5/16,29.8,7.66,23.33,3,1,Indian,https://www.iplt20.com/teams/chennai-super-kings/squad/9/ravindra-jadeja,Chennai Super Kings
12 | 11,Ashish Nehra,88,88,318.0,2495,106,4/10,23.53,7.84,18.0,1,0,Indian,https://www.iplt20.com/teams/sunrisers-hyderabad/squad/115/ashish-nehra,Sunrisers Hyderabad
13 | 12,Yuzvendra Chahal,87,86,309.5,2409,105,4/25,22.94,7.77,17.7,2,0,Indian,https://www.iplt20.com/teams/royal-challengers-bangalore/squad/111/yuzvendra-chahal,Royal Challengers Bangalore
14 | 13,Vinay Kumar,105,104,353.3,2966,105,4/40,28.24,8.39,20.2,1,0,Indian,https://www.iplt20.com/teams/kolkata-knight-riders/squad/166/vinay-kumar,Kolkata Knight Riders
15 | 14,Zaheer Khan,100,99,366.4,2782,102,4/17,27.27,7.58,21.56,1,0,Indian,https://www.iplt20.com/teams/delhi-capitals/squad/165/zaheer-khan,Delhi Capitals
16 | 15,Dale Steyn,94,94,358.4,2465,97,3/8,25.41,6.87,22.18,0,0,Overseas,https://www.iplt20.com/teams/royal-challengers-bangalore/squad/180/dale-steyn,Royal Challengers Bangalore
17 | 16,Sandeep Sharma,80,80,294.5,2308,95,4/20,24.29,7.82,18.62,2,0,Indian,https://www.iplt20.com/teams/sunrisers-hyderabad/squad/1112/sandeep-sharma,Sunrisers Hyderabad
18 | 17,Shane Watson,137,105,338.1,2682,92,4/29,29.15,7.93,22.05,1,0,Overseas,https://www.iplt20.com/teams/chennai-super-kings/squad/227/shane-watson,Chennai Super Kings
19 | 18,Mohit Sharma,86,86,292.2,2470,92,4/14,26.84,8.44,19.06,1,0,Indian,https://www.iplt20.com/teams/delhi-capitals/squad/1107/mohit-sharma,Delhi Capitals
20 | 19,Praveen Kumar,119,119,420.4,3251,90,3/18,36.12,7.72,28.04,0,0,Indian,,Nan
21 | 20,RP Singh,82,82,295.5,2338,90,4/22,25.97,7.9,19.72,2,0,Indian,,Nan
22 | 21,Pragyan Ojha,92,90,316.3,2332,89,3/11,26.2,7.36,21.33,0,0,Indian,https://www.iplt20.com/teams/mumbai-indians/squad/106/pragyan-ojha,Mumbai Indians
23 | 22,Dhawal Kulkarni,90,90,290.5,2404,86,4/14,27.95,8.26,20.29,1,0,Indian,https://www.iplt20.com/teams/mumbai-indians/squad/101/dhawal-kulkarni,Mumbai Indians
24 | 23,Jasprit Bumrah,80,80,300.4,2298,85,3/7,27.03,7.64,21.22,0,0,Indian,https://www.iplt20.com/teams/mumbai-indians/squad/1124/jasprit-bumrah,Mumbai Indians
25 | 24,Albie Morkel,91,87,287.1,2355,85,4/32,27.7,8.2,20.27,1,0,Overseas,,Nan
26 | 25,Irfan Pathan,103,101,340.3,2649,80,3/24,33.11,7.77,25.53,0,0,Indian,,Nan
27 | 26,Imran Tahir,55,55,204.2,1611,79,4/12,20.39,7.88,15.51,3,0,Overseas,https://www.iplt20.com/teams/chennai-super-kings/squad/898/imran-tahir,Chennai Super Kings
28 | 27,Morne Morkel,70,70,271.3,2089,77,4/20,27.12,7.69,21.15,1,0,Overseas,https://www.iplt20.com/teams/kolkata-knight-riders/squad/169/morne-morkel,Kolkata Knight Riders
29 | 28,Jaydev Unadkat,75,74,258.0,2266,77,5/25,29.42,8.78,20.1,0,2,Indian,https://www.iplt20.com/teams/rajasthan-royals/squad/86/jaydev-unadkat,Rajasthan Royals
30 | 29,Lakshmipathy Balaji,73,73,251.5,2028,76,5/24,26.68,8.05,19.88,3,1,Indian,https://www.iplt20.com/teams/kings-xi-punjab/squad/87/lakshmipathy-balaji,Kings Xi Punjab
31 | 30,Munaf Patel,63,63,225.5,1698,74,5/21,22.94,7.51,18.31,2,1,Indian,,Nan
32 | 31,Axar Patel,85,84,295.3,2175,73,4/21,29.79,7.36,24.28,1,0,Indian,https://www.iplt20.com/teams/delhi-capitals/squad/1113/axar-patel,Delhi Capitals
33 | 32,Ishant Sharma,90,90,321.5,2606,72,5/12,36.19,8.09,26.81,0,1,Indian,https://www.iplt20.com/teams/delhi-capitals/squad/38/ishant-sharma,Delhi Capitals
34 | 33,Rajat Bhatia,95,91,272.4,2020,71,4/15,28.45,7.4,23.04,1,0,Indian,,Nan
35 | 34,Mitchell McClenaghan,56,56,212.2,1803,71,4/21,25.39,8.49,17.94,1,0,Overseas,https://www.iplt20.com/teams/mumbai-indians/squad/730/mitchell-mcclenaghan,Mumbai Indians
36 | 35,Chris Morris,61,61,214.0,1709,69,4/23,24.76,7.98,18.6,2,0,Overseas,https://www.iplt20.com/teams/royal-challengers-bangalore/squad/836/chris-morris,Royal Challengers Bangalore
37 | 36,Ashok Dinda,78,75,251.4,2071,68,4/18,30.45,8.22,22.2,1,0,Indian,,Nan
38 | 37,Siddharth Trivedi,76,75,251.0,1904,65,4/25,29.29,7.58,23.16,1,0,Indian,https://www.iplt20.com/teams/rajasthan-royals/squad/147/siddharth-trivedi,Rajasthan Royals
39 | 38,Jacques Kallis,98,89,290.2,2293,65,3/13,35.27,7.89,26.8,0,0,Overseas,https://www.iplt20.com/teams/kolkata-knight-riders/squad/198/jacques-kallis,Kolkata Knight Riders
40 | 39,Muttiah Muralitharan,66,66,254.0,1696,63,3/11,26.92,6.67,24.19,0,0,Overseas,https://www.iplt20.com/teams/royal-challengers-bangalore/squad/241/muttiah-muralitharan,Royal Challengers Bangalore
41 | 40,Mitchell Johnson,54,54,205.2,1702,61,3/26,27.9,8.28,20.19,0,0,Overseas,https://www.iplt20.com/teams/kolkata-knight-riders/squad/213/mitchell-johnson,Kolkata Knight Riders
42 | 41,Rashid Khan,49,49,194.0,1263,59,3/14,21.4,6.51,19.72,0,0,Overseas,https://www.iplt20.com/teams/sunrisers-hyderabad/squad/2885/rashid-khan,Sunrisers Hyderabad
43 | 42,Shakib Al Hasan,63,62,221.2,1652,59,3/17,28.0,7.46,22.5,0,0,Overseas,https://www.iplt20.com/teams/sunrisers-hyderabad/squad/201/shakib-al-hasan,Sunrisers Hyderabad
44 | 43,James Faulkner,60,60,204.3,1778,59,5/16,30.13,8.69,20.79,0,2,Overseas,,Nan
45 | 44,Shane Warne,55,54,199.0,1447,57,4/21,25.38,7.27,20.94,1,0,Overseas,https://www.iplt20.com/teams/rajasthan-royals/squad/292/shane-warne,Rajasthan Royals
46 | 45,Kieron Pollard,151,83,203.5,1804,57,4/44,31.64,8.85,21.45,1,0,Overseas,https://www.iplt20.com/teams/mumbai-indians/squad/210/kieron-pollard,Mumbai Indians
47 | 46,Andre Russell,66,63,177.1,1571,57,4/20,27.56,8.86,18.64,1,0,Overseas,https://www.iplt20.com/teams/kolkata-knight-riders/squad/177/andre-russell,Kolkata Knight Riders
48 | 47,Karn Sharma,62,61,184.4,1445,54,4/16,26.75,7.82,20.51,2,0,Indian,https://www.iplt20.com/teams/chennai-super-kings/squad/1118/karn-sharma,Chennai Super Kings
49 | 48,Siddarth Kaul,45,45,163.3,1385,49,4/29,28.26,8.47,20.02,1,0,Indian,https://www.iplt20.com/teams/sunrisers-hyderabad/squad/1086/siddarth-kaul,Sunrisers Hyderabad
50 | 49,Shadab Jakati,59,57,180.5,1450,47,4/22,30.85,8.01,23.08,2,0,Indian,,Nan
51 | 50,Mohammad Shami,54,52,183.0,1629,47,3/15,34.65,8.9,23.36,0,0,Indian,https://www.iplt20.com/teams/kings-xi-punjab/squad/94/mohammad-shami,Kings Xi Punjab
52 | 51,Anil Kumble,42,42,160.5,1058,45,5/5,23.51,6.57,21.44,2,1,Indian,https://www.iplt20.com/teams/royal-challengers-bangalore/squad/331/anil-kumble,Royal Challengers Bangalore
53 | 52,Ryan Harris,37,37,138.4,1047,45,4/34,23.26,7.55,18.48,1,0,Overseas,https://www.iplt20.com/teams/kings-xi-punjab/squad/190/ryan-harris,Kings Xi Punjab
54 | 53,Sreenath Aravind,38,38,126.4,1039,45,4/14,23.08,8.2,16.88,2,0,Indian,https://www.iplt20.com/teams/royal-challengers-bangalore/squad/162/sreenath-aravind,Royal Challengers Bangalore
55 | 54,Trent Boult,36,36,138.5,1207,43,3/19,28.06,8.69,19.37,0,0,Overseas,https://www.iplt20.com/teams/mumbai-indians/squad/969/trent-boult,Mumbai Indians
56 | 55,Harshal Patel,43,41,139.2,1215,43,3/28,28.25,8.72,19.44,0,0,Indian,https://www.iplt20.com/teams/delhi-capitals/squad/157/harshal-patel,Delhi Capitals
57 | 56,Yusuf Pathan,174,82,191.1,1415,42,3/20,33.69,7.4,27.3,0,0,Indian,https://www.iplt20.com/teams/sunrisers-hyderabad/squad/96/yusuf-pathan,Sunrisers Hyderabad
58 | 57,Shahbaz Nadeem,64,62,209.5,1570,42,3/16,37.38,7.48,29.97,0,0,Indian,https://www.iplt20.com/teams/sunrisers-hyderabad/squad/57/shahbaz-nadeem,Sunrisers Hyderabad
59 | 58,Varun Aaron,47,45,152.4,1335,42,3/16,31.78,8.74,21.8,0,0,Indian,https://www.iplt20.com/teams/rajasthan-royals/squad/61/varun-aaron,Rajasthan Royals
60 | 59,Hardik Pandya,69,60,144.5,1313,42,3/20,31.26,9.06,20.69,0,0,Indian,https://www.iplt20.com/teams/mumbai-indians/squad/2740/hardik-pandya,Mumbai Indians
61 | 60,Krunal Pandya,58,56,165.2,1198,41,3/14,29.21,7.24,24.19,0,0,Indian,https://www.iplt20.com/teams/mumbai-indians/squad/3183/krunal-pandya,Mumbai Indians
62 | 61,Rahul Sharma,44,44,154.4,1086,40,3/13,27.15,7.02,23.2,0,0,Indian,https://www.iplt20.com/teams/chennai-super-kings/squad/126/rahul-sharma,Chennai Super Kings
63 | 62,Iqbal Abdulla,49,48,153.2,1109,40,3/24,27.72,7.23,23.0,0,0,Indian,https://www.iplt20.com/teams/royal-challengers-bangalore/squad/85/iqbal-abdulla,Royal Challengers Bangalore
64 | 63,Shanthakumaran Sreesanth,44,44,146.4,1194,40,3/29,29.85,8.14,22.0,0,0,Indian,https://www.iplt20.com/teams/rajasthan-royals/squad/150/shanthakumaran-sreesanth,Rajasthan Royals
65 | 64,Shreyas Gopal,33,32,106.1,819,39,4/16,21.0,7.71,16.33,1,0,Indian,https://www.iplt20.com/teams/rajasthan-royals/squad/1748/shreyas-gopal,Rajasthan Royals
66 | 65,Parvinder Awana,33,33,124.3,1029,39,4/34,26.38,8.26,19.15,1,0,Indian,https://www.iplt20.com/teams/kings-xi-punjab/squad/254/parvinder-awana,Kings Xi Punjab
67 | 66,Andrew Tye,26,26,99.0,822,39,5/17,21.07,8.3,15.23,3,1,Overseas,https://www.iplt20.com/teams/rajasthan-royals/squad/1480/andrew-tye,Rajasthan Royals
68 | 67,Kuldeep Yadav,42,41,143.2,1198,39,4/20,30.71,8.35,22.05,1,0,Indian,https://www.iplt20.com/teams/kolkata-knight-riders/squad/261/kuldeep-yadav,Kolkata Knight Riders
69 | 68,Kagiso Rabada,21,21,80.2,631,38,4/21,16.6,7.85,12.68,2,0,Overseas,https://www.iplt20.com/teams/delhi-capitals/squad/1664/kagiso-rabada,Delhi Capitals
70 | 69,Moises Henriques,57,55,148.2,1244,38,3/16,32.73,8.38,23.42,0,0,Overseas,https://www.iplt20.com/teams/kings-xi-punjab/squad/388/moises-henriques,Kings Xi Punjab
71 | 70,Doug Bollinger,27,27,96.0,693,37,4/13,18.72,7.21,15.56,1,0,Overseas,https://www.iplt20.com/teams/chennai-super-kings/squad/18/doug-bollinger,Chennai Super Kings
72 | 71,Manpreet Gony,44,44,148.0,1287,37,3/31,34.78,8.69,24.0,0,0,Indian,,Nan
73 | 72,Yuvraj Singh,132,73,144.5,1077,36,4/29,29.91,7.43,24.13,2,0,Indian,https://www.iplt20.com/teams/mumbai-indians/squad/113/yuvraj-singh,Mumbai Indians
74 | 73,Nathan Coulter-Nile,26,25,93.5,719,36,4/20,19.97,7.66,15.63,1,0,Overseas,https://www.iplt20.com/teams/mumbai-indians/squad/840/nathan-coulter-nile,Mumbai Indians
75 | 74,Deepak Chahar,37,37,126.4,976,36,3/15,27.11,7.7,21.11,0,0,Indian,https://www.iplt20.com/teams/chennai-super-kings/squad/140/deepak-chahar,Chennai Super Kings
76 | 75,Shardul Thakur,36,35,117.5,1065,36,3/19,29.58,9.03,19.63,0,0,Indian,https://www.iplt20.com/teams/chennai-super-kings/squad/1745/shardul-thakur,Chennai Super Kings
77 | 76,Pradeep Sangwan,39,39,133.4,1175,35,3/18,33.57,8.79,22.91,0,0,Indian,https://www.iplt20.com/teams/mumbai-indians/squad/91/pradeep-sangwan,Mumbai Indians
78 | 77,Mitchell Starc,27,26,96.4,693,34,4/15,20.38,7.16,17.05,1,0,Overseas,https://www.iplt20.com/teams/royal-challengers-bangalore/squad/490/mitchell-starc,Royal Challengers Bangalore
79 | 78,Pawan Negi,50,42,119.2,939,34,4/18,27.61,7.86,21.05,1,0,Indian,https://www.iplt20.com/teams/royal-challengers-bangalore/squad/53/pawan-negi,Royal Challengers Bangalore
80 | 79,Dan Christian,40,40,130.3,1037,34,2/10,30.5,7.94,23.02,0,0,Overseas,https://www.iplt20.com/teams/delhi-capitals/squad/181/dan-christian,Delhi Capitals
81 | 80,Kevon Cooper,25,25,96.0,757,33,4/26,22.93,7.88,17.45,1,0,Overseas,https://www.iplt20.com/teams/rajasthan-royals/squad/232/kevon-cooper,Rajasthan Royals
82 | 81,Murali Kartik,56,55,191.3,1388,31,3/17,44.77,7.24,37.06,0,0,Indian,https://www.iplt20.com/teams/kings-xi-punjab/squad/125/murali-kartik,Kings Xi Punjab
83 | 82,Thisara Perera,37,36,116.2,1016,31,3/20,32.77,8.73,22.51,0,0,Overseas,,Nan
84 | 83,Azhar Mahmood,23,23,89.3,700,29,3/20,24.13,7.82,18.51,0,0,Overseas,https://www.iplt20.com/teams/kolkata-knight-riders/squad/194/azhar-mahmood,Kolkata Knight Riders
85 | 84,Ajit Agarkar,42,42,130.2,1151,29,3/25,39.68,8.83,26.96,0,0,Indian,https://www.iplt20.com/teams/delhi-capitals/squad/47/ajit-agarkar,Delhi Capitals
86 | 85,Daniel Vettori,34,34,129.3,879,28,3/15,31.39,6.78,27.75,0,0,Overseas,https://www.iplt20.com/teams/royal-challengers-bangalore/squad/243/daniel-vettori,Royal Challengers Bangalore
87 | 86,Dirk Nannes,29,29,107.4,785,28,3/27,28.03,7.29,23.07,0,0,Overseas,https://www.iplt20.com/teams/chennai-super-kings/squad/237/dirk-nannes,Chennai Super Kings
88 | 87,Pravin Tambe,33,33,110.0,853,28,4/20,30.46,7.75,23.57,1,0,Indian,https://www.iplt20.com/teams/sunrisers-hyderabad/squad/1114/pravin-tambe,Sunrisers Hyderabad
89 | 88,Amit Singh,23,23,78.5,620,28,4/19,22.14,7.86,16.89,1,0,Indian,https://www.iplt20.com/teams/rajasthan-royals/squad/137/amit-singh,Rajasthan Royals
90 | 89,Tim Southee,40,40,148.0,1293,28,3/24,46.17,8.73,31.71,0,0,Overseas,https://www.iplt20.com/teams/royal-challengers-bangalore/squad/307/tim-southee,Royal Challengers Bangalore
91 | 90,Mohammed Siraj,26,26,92.1,848,28,4/32,30.28,9.2,19.75,1,0,Indian,https://www.iplt20.com/teams/royal-challengers-bangalore/squad/3840/mohammed-siraj,Royal Challengers Bangalore
92 | 91,MF Maharoof,20,20,70.0,520,27,3/34,19.25,7.42,15.55,0,0,Overseas,https://www.iplt20.com/teams/delhi-capitals/squad/311/mf-maharoof,Delhi Capitals
93 | 92,Jofra Archer,23,23,89.5,688,27,3/15,25.48,7.65,19.96,0,0,Overseas,https://www.iplt20.com/teams/rajasthan-royals/squad/3502/jofra-archer,Rajasthan Royals
94 | 93,Angelo Mathews,49,44,131.5,1079,27,4/19,39.96,8.18,29.29,1,0,Overseas,https://www.iplt20.com/teams/delhi-capitals/squad/217/angelo-mathews,Delhi Capitals
95 | 94,Wayne Parnell,26,26,95.2,701,26,3/27,26.96,7.35,22.0,0,0,Overseas,https://www.iplt20.com/teams/delhi-capitals/squad/223/wayne-parnell,Delhi Capitals
96 | 95,Ben Stokes,34,30,97.5,808,26,3/15,31.07,8.25,22.57,0,0,Overseas,https://www.iplt20.com/teams/rajasthan-royals/squad/1154/ben-stokes,Rajasthan Royals
97 | 96,Dwayne Smith,91,46,89.5,810,26,4/8,31.15,9.01,20.73,1,0,Overseas,,Nan
98 | 97,Johan Botha,34,34,115.4,800,25,3/6,32.0,6.91,27.76,0,0,Overseas,https://www.iplt20.com/teams/kolkata-knight-riders/squad/224/johan-botha,Kolkata Knight Riders
99 | 98,Suresh Raina,193,69,151.2,1118,25,2/0,44.72,7.38,36.32,0,0,Indian,https://www.iplt20.com/teams/chennai-super-kings/squad/14/suresh-raina,Chennai Super Kings
100 | 99,Brett Lee,38,38,145.5,1095,25,3/15,43.8,7.5,35.0,0,0,Overseas,https://www.iplt20.com/teams/kolkata-knight-riders/squad/196/brett-lee,Kolkata Knight Riders
101 | 100,Harmeet Singh Bansal,27,26,84.3,674,25,3/24,26.96,7.97,20.28,0,0,Indian,https://www.iplt20.com/teams/kings-xi-punjab/squad/70/harmeet-singh-bansal,Kings Xi Punjab
102 |
--------------------------------------------------------------------------------
/data/fastest_centuries.csv:
--------------------------------------------------------------------------------
1 | POS,PLAYER,Against,Venue,Match Date,BF,6s,4s,Runs,Season
2 | 1,Jonny Bairstow,RCB,Rajiv Gandhi Intl. Cricket Stadium,2019-03-31,52,7,12,114,2019
3 | 2,Sanju Samson,SRH,Rajiv Gandhi Intl. Cricket Stadium,2019-03-29,54,4,10,102,2019
4 | 3,David Warner,RCB,Rajiv Gandhi Intl. Cricket Stadium,2019-03-31,54,5,5,100,2019
5 | 4,Virat Kohli,KKR,Eden Gardens,2019-04-19,57,4,9,100,2019
6 | 5,Ajinkya Rahane,DC,Sawai Mansingh Stadium,2019-04-22,58,3,11,105,2019
7 | 6,KL Rahul,MI,Wankhede Stadium,2019-04-10,63,6,6,100,2019
8 | 1,Shane Watson,SRH,Wankhede Stadium,2018-05-27,51,8,11,117,2018
9 | 2,Shane Watson,RR,Maharashtra Cricket Association's International Stadium,2018-04-20,51,6,9,106,2018
10 | 3,Rishabh Pant,SRH,Feroz Shah Kotla Ground,2018-05-10,56,7,15,128,2018
11 | 4,Chris Gayle,SRH,IS Bindra Stadium,2018-04-19,58,11,1,104,2018
12 | 5,Ambati Rayudu,SRH,Maharashtra Cricket Association's International Stadium,2018-05-13,62,7,7,100,2018
13 | 1,David Warner,KKR,Rajiv Gandhi Intl. Cricket Stadium,2017-04-30,43,8,10,126,2017
14 | 2,Hashim Amla,MI,Holkar Cricket Stadium,2017-04-20,58,6,8,104,2017
15 | 3,Hashim Amla,GL,IS Bindra Stadium,2017-05-07,59,5,8,104,2017
16 | 4,Ben Stokes,GL,Maharashtra Cricket Association's International Stadium,2017-05-01,61,6,7,103,2017
17 | 5,Sanju Samson,RPS,Maharashtra Cricket Association's International Stadium,2017-04-11,62,5,8,102,2017
18 | 1,AB de Villiers,GL,M. Chinnaswamy Stadium,2016-05-14,43,12,10,129,2016
19 | 2,Virat Kohli,KXIP,M. Chinnaswamy Stadium,2016-05-18,47,8,12,113,2016
20 | 3,Quinton de Kock,RCB,M. Chinnaswamy Stadium,2016-04-17,48,3,15,108,2016
21 | 4,Virat Kohli,GL,M. Chinnaswamy Stadium,2016-05-14,53,8,5,109,2016
22 | 5,Steve Smith,GL,Maharashtra Cricket Association's International Stadium,2016-04-29,53,5,8,101,2016
23 | 6,Virat Kohli,RPS,M. Chinnaswamy Stadium,2016-05-07,56,7,8,108,2016
24 | 7,Virat Kohli,GL,Saurashtra Cricket Association Stadium,2016-04-24,63,1,11,100,2016
25 | 1,Chris Gayle,KXIP,M. Chinnaswamy Stadium,2015-05-06,46,12,7,117,2015
26 | 2,AB de Villiers,MI,Wankhede Stadium,2015-05-10,47,4,19,133,2015
27 | 3,Brendon McCullum,SRH,Chidambaram,2015-04-11,56,9,7,100,2015
28 | 4,Shane Watson,KKR,Brabourne Stadium,2015-05-16,57,5,9,104,2015
29 | 1,Wriddhiman Saha,KKR,M. Chinnaswamy Stadium,2014-06-01,49,8,10,115,2014
30 | 2,Virender Sehwag,CSK,Wankhede Stadium,2014-05-30,50,8,12,122,2014
31 | 3,Lendl Simmons,KXIP,IS Bindra Stadium,2014-05-21,61,2,14,100,2014
32 | 1,Chris Gayle,PWI,M. Chinnaswamy Stadium,2013-04-23,30,17,13,175,2013
33 | 2,David Miller,RCB,IS Bindra Stadium,2013-05-06,38,7,8,101,2013
34 | 3,Suresh Raina,KXIP,Chidambaram,2013-05-02,53,6,7,100,2013
35 | 4,Shane Watson,CSK,Chidambaram,2013-04-22,60,6,6,101,2013
36 | 1,Murali Vijay,DC,Chidambaram,2012-05-25,51,4,15,113,2012
37 | 2,David Warner,DEC,Rajiv Gandhi Intl. Cricket Stadium,2012-05-10,52,7,10,109,2012
38 | 3,Rohit Sharma,KKR,Eden Gardens,2012-05-12,52,5,12,109,2012
39 | 4,Chris Gayle,DC,Feroz Shah Kotla Ground,2012-05-17,53,13,7,128,2012
40 | 5,Ajinkya Rahane,RCB,M. Chinnaswamy Stadium,2012-04-15,58,5,12,103,2012
41 | 6,Kevin Pietersen,DEC,Feroz Shah Kotla Ground,2012-04-19,64,9,6,103,2012
42 | 1,Chris Gayle,KXIP,M. Chinnaswamy Stadium,2011-05-06,46,9,10,107,2011
43 | 2,Virender Sehwag,DEC,Rajiv Gandhi Intl. Cricket Stadium,2011-05-05,48,6,13,119,2011
44 | 3,Paul Valthaty,CSK,IS Bindra Stadium,2011-04-13,52,2,19,120,2011
45 | 4,Adam Gilchrist,RCB,HPCA Stadium,2011-05-17,53,9,8,106,2011
46 | 5,Chris Gayle,KKR,Eden Gardens,2011-04-22,55,7,10,102,2011
47 | 6,Sachin Tendulkar,KTK,Wankhede Stadium,2011-04-15,66,3,12,100,2011
48 | 1,Yusuf Pathan,MI,Brabourne Stadium,2010-03-13,37,8,9,100,2010
49 | 2,Murali Vijay,RR,Chidambaram,2010-04-03,46,11,8,127,2010
50 | 3,Mahela Jayawardene,KKR,Eden Gardens,2010-04-04,55,3,14,110,2010
51 | 4,David Warner,KKR,Feroz Shah Kotla Ground,2010-03-29,66,5,9,107,2010
52 | 1,Manish Pandey,DEC,Supersport Park,2009-05-21,67,4,10,114,2009
53 | 1,Adam Gilchrist,MI,DY Patil Stadium,2008-04-27,42,10,9,109,2008
54 | 2,Sanath Jayasuriya,CSK,Wankhede Stadium,2008-05-14,45,11,9,114,2008
55 | 3,Andrew Symonds,RR,Rajiv Gandhi Intl. Cricket Stadium,2008-04-24,47,7,11,117,2008
56 | 4,Michael Hussey,KXIP,IS Bindra Stadium,2008-04-19,50,9,8,116,2008
57 | 5,Brendon McCullum,RCB,M. Chinnaswamy Stadium,2008-04-18,53,13,10,158,2008
58 | 6,Shaun Marsh,RR,IS Bindra Stadium,2008-05-28,58,7,11,115,2008
59 |
--------------------------------------------------------------------------------
/data/points_table.csv:
--------------------------------------------------------------------------------
1 | Team,Mat,Won,Lost,Tied,N/R,Points,Net R/R,For,Against,Season
2 | Mumbai Indians,14.0,9.0,5.0,0.0,0.0,18.0,0.421,2380/275.1,2282/277.2,2019
3 | Chennai Super Kings,14.0,9.0,5.0,0.0,0.0,18.0,0.131,2043/274.1,2012/274.5,2019
4 | Delhi Capitals,14.0,9.0,5.0,0.0,0.0,18.0,0.044,2207/272.5,2238/278.1,2019
5 | Sunrisers Hyderabad,14.0,6.0,8.0,0.0,0.0,12.0,0.577,2288/269.2,2200/277.5,2019
6 | Kolkata Knight Riders,14.0,6.0,8.0,0.0,0.0,12.0,0.028,2466/270.4,2419/266.2,2019
7 | Kings XI Punjab,14.0,6.0,8.0,0.0,0.0,12.0,-0.251,2429/276.3,2503/277.0,2019
8 | Rajasthan Royals,14.0,5.0,8.0,0.0,1.0,11.0,-0.449,2153/257.0,2192/248.2,2019
9 | Royal Challengers Bangalore,14.0,5.0,8.0,0.0,1.0,11.0,-0.607,2146/258.4,2266/254.3,2019
10 | Sunrisers Hyderabad,14.0,9.0,5.0,0.0,0.0,18.0,0.284,2230/273.3,2193/278.4,2018
11 | Chennai Super Kings,14.0,9.0,5.0,0.0,0.0,18.0,0.253,2488/275.3,2433/277.1,2018
12 | Kolkata Knight Riders,14.0,8.0,6.0,0.0,0.0,16.0,-0.07,2363/265.1,2425/270.0,2018
13 | Rajasthan Royals,14.0,7.0,7.0,0.0,0.0,14.0,-0.25,2130/255.3,2141/249.2,2018
14 | Mumbai Indians,14.0,6.0,8.0,0.0,0.0,12.0,0.317,2380/278.4,2282/277.3,2018
15 | Royal Challengers Bangalore,14.0,6.0,8.0,0.0,0.0,12.0,0.129,2322/264.4,2383/275.4,2018
16 | Kings XI Punjab,14.0,6.0,8.0,0.0,0.0,12.0,-0.502,2210/268.4,2259/258.5,2018
17 | Delhi Capitals,14.0,5.0,9.0,0.0,0.0,10.0,-0.222,2297/258.0,2304/252.3,2018
18 | Mumbai Indians,14.0,10.0,4.0,0.0,0.0,20.0,0.784,2407/272.1,2242/278.1,2017
19 | Rising Pune Supergiant,14.0,9.0,5.0,0.0,0.0,18.0,0.176,2180/271.0,2165/275.1,2017
20 | Sunrisers Hyderabad,14.0,8.0,5.0,0.0,1.0,17.0,0.469,2221/252.0,2118/253.5,2017
21 | Kolkata Knight Riders,14.0,8.0,6.0,0.0,0.0,16.0,0.641,2329/260.5,2300/277.3,2017
22 | Kings XI Punjab,14.0,7.0,7.0,0.0,0.0,14.0,0.123,2207/257.2,2229/263.4,2017
23 | Delhi Capitals,14.0,6.0,8.0,0.0,0.0,12.0,-0.512,2219/276.2,2255/264.0,2017
24 | Gujarat Lions,14.0,4.0,10.0,0.0,0.0,8.0,-0.412,2406/269.5,2472/265.0,2017
25 | Royal Challengers Bangalore,14.0,3.0,10.0,0.0,1.0,7.0,-1.299,1845/260.0,2033/242.1,2017
26 | Gujarat Lions,14.0,9.0,5.0,0.0,0.0,18.0,-0.374,2130/264.3,2285/271.1,2016
27 | Royal Challengers Bangalore,14.0,8.0,6.0,0.0,0.0,16.0,0.932,2613/270.2,2345/268.3,2016
28 | Sunrisers Hyderabad,14.0,8.0,6.0,0.0,0.0,16.0,0.245,2082/259.5,2078/267.3,2016
29 | Kolkata Knight Riders,14.0,8.0,6.0,0.0,0.0,16.0,0.106,2123/253.2,2121/256.2,2016
30 | Mumbai Indians,14.0,7.0,7.0,0.0,0.0,14.0,-0.146,2194/272.2,2190/267.0,2016
31 | Delhi Capitals,14.0,7.0,7.0,0.0,0.0,14.0,-0.155,2040/259.1,2107/262.3,2016
32 | Rising Pune Supergiant,14.0,5.0,9.0,0.0,0.0,10.0,0.015,2025/244.5,1991/241.1,2016
33 | Kings XI Punjab,14.0,4.0,10.0,0.0,0.0,8.0,-0.646,2134/269.4,2224/259.5,2016
34 | Chennai Super Kings,14.0,9.0,5.0,0.0,0.0,18.0,0.709,2262/273.3,2073/274.1,2015
35 | Mumbai Indians,14.0,8.0,6.0,0.0,0.0,16.0,-0.043,2345/272.4,2371/274.2,2015
36 | Royal Challengers Bangalore,14.0,7.0,5.0,0.0,2.0,16.0,1.037,1790/191.1,1693/203.2,2015
37 | Rajasthan Royals,14.0,7.0,5.0,0.0,2.0,16.0,0.062,2028/237.3,2002/236.1,2015
38 | Kolkata Knight Riders,14.0,7.0,6.0,0.0,1.0,15.0,0.253,2044/236.1,2022/240.4,2015
39 | Sunrisers Hyderabad,14.0,7.0,7.0,0.0,0.0,14.0,-0.239,2096/255.2,2126/251.4,2015
40 | Delhi Capitals,14.0,5.0,8.0,0.0,1.0,11.0,-0.049,1981/250.2,1976/248.1,2015
41 | Kings XI Punjab,14.0,3.0,11.0,0.0,0.0,6.0,-1.436,2003/270.0,2286/258.1,2015
42 | Kings XI Punjab,14.0,11.0,3.0,0.0,0.0,22.0,0.968,2427/268.3,2229/276.1,2014
43 | Kolkata Knight Riders,14.0,9.0,5.0,0.0,0.0,18.0,0.418,2125/264.0,2110/276.3,2014
44 | Chennai Super Kings,14.0,9.0,5.0,0.0,0.0,18.0,0.385,2272/272.0,2178/273.2,2014
45 | Mumbai Indians,14.0,7.0,7.0,0.0,0.0,14.0,0.095,2180/271.3,2170/273.3,2014
46 | Rajasthan Royals,14.0,7.0,7.0,0.0,0.0,14.0,0.06,2155/269.5,2164/273.0,2014
47 | Sunrisers Hyderabad,14.0,6.0,8.0,0.0,0.0,12.0,-0.399,2102/263.4,2136/255.1,2014
48 | Royal Challengers Bangalore,14.0,5.0,9.0,0.0,0.0,10.0,-0.428,2093/273.5,2163/268.0,2014
49 | Delhi Capitals,14.0,2.0,12.0,0.0,0.0,4.0,-1.182,1980/263.2,2184/251.0,2014
50 | Chennai Super Kings,16.0,11.0,5.0,0.0,0.0,22.0,0.53,2461/303.5,2310/305.1,2013
51 | Mumbai Indians,16.0,11.0,5.0,0.0,0.0,22.0,0.441,2514/318.1,2350/315.0,2013
52 | Rajasthan Royals,16.0,10.0,6.0,0.0,0.0,20.0,0.322,2405/310.5,2326/313.4,2013
53 | Sunrisers Hyderabad,16.0,10.0,6.0,0.0,0.0,20.0,0.003,2166/308.5,2206/314.4,2013
54 | Royal Challengers Bangalore,16.0,9.0,7.0,0.0,0.0,18.0,0.457,2571/301.0,2451/303.1,2013
55 | Kings XI Punjab,16.0,8.0,8.0,0.0,0.0,16.0,0.226,2428/305.2,2417/312.5,2013
56 | Kolkata Knight Riders,16.0,6.0,10.0,0.0,0.0,12.0,-0.095,2290/313.4,2316/313.1,2013
57 | Pune Warriors,16.0,4.0,12.0,0.0,0.0,8.0,-1.006,2262/318.4,2519/310.5,2013
58 | Delhi Capitals,16.0,3.0,13.0,0.0,0.0,6.0,-0.848,2234/314.5,2436/306.4,2013
59 | Delhi Capitals,16.0,11.0,5.0,0.0,0.0,22.0,0.617,2365/283.5,2361/306.0,2012
60 | Kolkata Knight Riders,16.0,10.0,5.0,0.0,1.0,21.0,0.561,2150/285.1,2032/291.1,2012
61 | Mumbai Indians,16.0,10.0,6.0,0.0,0.0,20.0,-0.1,2313/312.3,2343/312.2,2012
62 | Chennai Super Kings,16.0,8.0,7.0,0.0,1.0,17.0,0.1,2232/293.3,2144/285.4,2012
63 | Royal Challengers Bangalore,16.0,8.0,7.0,0.0,1.0,17.0,-0.022,2472/296.2,2505/299.3,2012
64 | Kings XI Punjab,16.0,8.0,8.0,0.0,0.0,16.0,-0.216,2390/313.3,2455/313.1,2012
65 | Rajasthan Royals,16.0,7.0,9.0,0.0,0.0,14.0,0.201,2516/316.0,2402/309.3,2012
66 | Deccan Chargers,16.0,4.0,11.0,0.0,1.0,9.0,-0.509,2312/298.4,2405/291.3,2012
67 | Pune Warriors,16.0,4.0,12.0,0.0,0.0,8.0,-0.551,2321/319.2,2424/310.0,2012
68 | Royal Challengers Bangalore,14.0,9.0,4.0,0.0,1.0,19.0,0.326,1962/237.0,2000/251.3,2011
69 | Chennai Super Kings,14.0,9.0,5.0,0.0,0.0,18.0,0.431,2115/265.1,1978/262.1,2011
70 | Mumbai Indians,14.0,9.0,5.0,0.0,0.0,18.0,0.04,1998/275.2,1951/270.2,2011
71 | Kolkata Knight Riders,14.0,8.0,6.0,0.0,0.0,16.0,0.433,1888/249.2,1861/260.4,2011
72 | Kings XI Punjab,14.0,7.0,7.0,0.0,0.0,14.0,-0.051,2224/275.4,2173/267.4,2011
73 | Rajasthan Royals,14.0,6.0,7.0,0.0,1.0,13.0,-0.691,1687/242.2,1801/235.2,2011
74 | Deccan Chargers,14.0,6.0,8.0,0.0,0.0,12.0,0.222,2140/279.2,2037/273.5,2011
75 | Kochi Tuskers Kerala,14.0,6.0,8.0,0.0,0.0,12.0,-0.203,1901/256.2,1986/260.4,2011
76 | Pune Warriors,14.0,4.0,9.0,0.0,1.0,9.0,-0.134,1775/247.3,1858/254.2,2011
77 | Delhi Capitals,14.0,4.0,9.0,0.0,1.0,9.0,-0.448,2031/258.2,2076/249.5,2011
78 | Mumbai Indians,14.0,10.0,4.0,0.0,0.0,20.0,1.084,2408/277.0,2100/276.0,2010
79 | Deccan Chargers,14.0,8.0,6.0,0.0,0.0,16.0,-0.297,2188/277.4,2254/275.4,2010
80 | Chennai Super Kings,14.0,7.0,7.0,0.0,0.0,14.0,0.274,2285/271.1,2257/276.5,2010
81 | Royal Challengers Bangalore,14.0,7.0,7.0,0.0,0.0,14.0,0.219,2166/260.4,2245/277.3,2010
82 | Delhi Capitals,14.0,7.0,7.0,0.0,0.0,14.0,0.021,2155/275.4,2166/277.5,2010
83 | Kolkata Knight Riders,14.0,7.0,7.0,0.0,0.0,14.0,-0.341,2144/273.0,2192/267.3,2010
84 | Rajasthan Royals,14.0,6.0,8.0,0.0,0.0,12.0,-0.514,2179/270.4,2224/259.4,2010
85 | Kings XI Punjab,14.0,4.0,10.0,0.0,0.0,8.0,-0.478,2278/276.2,2365/271.1,2010
86 | Delhi Capitals,14.0,10.0,4.0,0.0,0.0,20.0,0.311,1978/255.2,1953/262.4,2009
87 | Chennai Super Kings,14.0,8.0,5.0,0.0,1.0,17.0,0.951,2086/255.3,1855/257.1,2009
88 | Royal Challengers Bangalore,14.0,8.0,6.0,0.0,0.0,16.0,-0.191,1994/276.0,2027/273.2,2009
89 | Deccan Chargers,14.0,7.0,7.0,0.0,0.0,14.0,0.203,2111/272.4,2097/278.1,2009
90 | Kings XI Punjab,14.0,7.0,7.0,0.0,0.0,14.0,-0.483,1787/251.2,1887/248.3,2009
91 | Rajasthan Royals,14.0,6.0,7.0,0.0,1.0,13.0,-0.352,1688/253.1,1810/257.5,2009
92 | Mumbai Indians,14.0,5.0,8.0,0.0,1.0,11.0,0.297,1897/256.2,1802/253.4,2009
93 | Kolkata Knight Riders,14.0,3.0,10.0,0.0,1.0,7.0,-0.789,1757/248.5,1867/237.5,2009
94 | Rajasthan Royals,14.0,11.0,3.0,0.0,0.0,22.0,0.632,2245/261.1,2153/270.2,2008
95 | Kings XI Punjab,14.0,10.0,4.0,0.0,0.0,20.0,0.509,2352/259.5,2271/265.5,2008
96 | Chennai Super Kings,14.0,8.0,6.0,0.0,0.0,16.0,-0.192,2241/264.2,2195/253.1,2008
97 | Delhi Capitals,14.0,7.0,6.0,0.0,1.0,15.0,0.342,2001/233.2,2031/246.4,2008
98 | Mumbai Indians,14.0,7.0,7.0,0.0,0.0,14.0,0.57,2080/249.1,2096/269.3,2008
99 | Kolkata Knight Riders,14.0,6.0,7.0,0.0,1.0,13.0,-0.147,1845/242.4,1718/221.4,2008
100 | Royal Challengers Bangalore,14.0,4.0,10.0,0.0,0.0,8.0,-1.16,1983/272.4,2205/261.3,2008
101 | Deccan Chargers,14.0,2.0,12.0,0.0,0.0,4.0,-0.467,2229/270.0,2307/264.3,2008
102 |
--------------------------------------------------------------------------------
/data/wins_losses.csv:
--------------------------------------------------------------------------------
1 | Team,Span,Matches,Won,Lost,No Result,Tied and won,Tied and lost,Win %,Titles
2 | Chennai Super Kings,"2008–2015, 2018–2020",167,101,64,0,1,1,61.14,3
3 | Delhi Capitals,2008–2020,178,76,97,2,1,2,44.03,0
4 | Kings XI Punjab,2008–2020,177,80,94,2,1,0,46.02,0
5 | Kolkata Knight Riders,2008–2020,178,92,83,0,3,0,52.52,2
6 | Mumbai Indians,2008–2020,188,107,79,2,0,0,57.44,4
7 | Rajasthan Royals,"2008–2015, 2018–2020",148,74,69,2,1,1,51.71,1
8 | Royal Challengers Banglore,2008–2020,182,84,92,1,1,4,47.75,0
9 | Sunrisers Hyderabad,2013–2020,109,57,50,1,1,0,53.21,1
10 |
--------------------------------------------------------------------------------
/images/batting_bar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bprasad26/ipl_data_analysis/07b7a917561e20420fd018a64c89187369a3887f/images/batting_bar.png
--------------------------------------------------------------------------------
/images/batting_beeswarm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bprasad26/ipl_data_analysis/07b7a917561e20420fd018a64c89187369a3887f/images/batting_beeswarm.png
--------------------------------------------------------------------------------
/images/batting_bf.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bprasad26/ipl_data_analysis/07b7a917561e20420fd018a64c89187369a3887f/images/batting_bf.png
--------------------------------------------------------------------------------
/images/batting_sr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bprasad26/ipl_data_analysis/07b7a917561e20420fd018a64c89187369a3887f/images/batting_sr.png
--------------------------------------------------------------------------------
/images/bowling_bar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bprasad26/ipl_data_analysis/07b7a917561e20420fd018a64c89187369a3887f/images/bowling_bar.png
--------------------------------------------------------------------------------
/images/bowling_beeswarm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bprasad26/ipl_data_analysis/07b7a917561e20420fd018a64c89187369a3887f/images/bowling_beeswarm.png
--------------------------------------------------------------------------------
/images/bowling_dots.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bprasad26/ipl_data_analysis/07b7a917561e20420fd018a64c89187369a3887f/images/bowling_dots.png
--------------------------------------------------------------------------------
/images/bowling_sr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bprasad26/ipl_data_analysis/07b7a917561e20420fd018a64c89187369a3887f/images/bowling_sr.png
--------------------------------------------------------------------------------
/ipl-app.py:
--------------------------------------------------------------------------------
1 | import warnings
2 |
3 | warnings.simplefilter(action="ignore", category=UserWarning)
4 | from dash_core_components.Dropdown import Dropdown
5 | from dash_core_components.Graph import Graph
6 | from dash_core_components.Markdown import Markdown
7 | from dash_html_components.Div import Div
8 | from dash_html_components.H2 import H2
9 | from dash_html_components.I import I
10 | from dash_html_components.Label import Label
11 | from dash_html_components.P import P
12 | from pandas._config.config import options
13 | from pandas.core.indexes import multi
14 | from pandas.io.formats import style
15 | import dash
16 | import dash_core_components as dcc
17 | import dash_bootstrap_components as dbc
18 | import dash_html_components as html
19 | from dash.dependencies import Input, Output
20 | import dash_table
21 | import plotly.graph_objects as go
22 | import plotly.express as px
23 | import pandas as pd
24 | import numpy as np
25 | import os
26 | import base64
27 |
28 | # function for loading data
29 | file_path = os.path.join(os.getcwd(), "data")
30 |
31 |
32 | def load_data(filename, file_path=file_path):
33 | csv_path = os.path.join(file_path, filename)
34 | return pd.read_csv(csv_path)
35 |
36 |
37 | # read the data
38 | points_table = load_data("points_table.csv")
39 | points_table["Net R/R"] = points_table["Net R/R"].round(3)
40 |
41 | wins_losses = load_data("wins_losses.csv")
42 | wins_losses.sort_values(by=["Titles", "Win %"], ascending=[False, False], inplace=True)
43 | wins_losses.drop("Span", axis=1, inplace=True)
44 |
45 | # read batting data
46 | batting = load_data("batting.csv")
47 | batting.iloc[batting[batting["PLAYER"] == "Rohit Sharma"].index, 16] = "Mumbai Indians"
48 | batting_players_list = list(batting["PLAYER"].unique())
49 |
50 | # batting aggregated data
51 | batting_agg = load_data("batting_all_time.csv")
52 |
53 |
54 | # read bowling data
55 | bowling = load_data("bowling.csv")
56 | bowling = bowling.rename(columns={"Maid": "Maiden"})
57 | bowling_players_list = list(bowling["PLAYER"].unique())
58 | # create a new column
59 | bowling["Runs/Inns"] = (bowling["Runs"] / bowling["Inns"]).round(2)
60 |
61 | # read bowling aggregated data
62 | bowling_agg = load_data("bowling_all_time.csv")
63 | # copy the data that is not avialable in aggregated csv
64 | bowling_subset = bowling[["PLAYER", "Dots", "Maiden"]].copy()
65 | # calculate aggregates and join
66 | bs_groupby = bowling_subset.groupby("PLAYER").sum().reset_index()
67 | bowling_agg = pd.merge(
68 | left=bowling_agg, right=bs_groupby, left_on="PLAYER", right_on="PLAYER"
69 | )
70 | # delete un-necessary column
71 | bowling_agg.drop("Player Link", axis=1, inplace=True)
72 | # create a new column
73 | bowling_agg["Runs/Inns"] = (bowling_agg["Runs"] / bowling_agg["Inns"]).round(2)
74 |
75 |
76 | batting_metrics_list = [
77 | "Runs",
78 | "HS",
79 | "Avg",
80 | "BF",
81 | "SR",
82 | "100",
83 | "50",
84 | "4s",
85 | "6s",
86 | "Mat",
87 | "Inns",
88 | "NO",
89 | ]
90 |
91 | bowling_metrics_list = [
92 | "Wkts",
93 | "Econ",
94 | "Avg",
95 | "SR",
96 | "Runs/Inns",
97 | "Dots",
98 | "4w",
99 | "5w",
100 | "Maiden",
101 | "Ov",
102 | ]
103 |
104 | team_list = [
105 | "All Teams",
106 | "Sunrisers Hyderabad",
107 | "Kings Xi Punjab",
108 | "Mumbai Indians",
109 | "Delhi Capitals",
110 | "Kolkata Knight Riders",
111 | "Royal Challengers Bangalore",
112 | "Chennai Super Kings",
113 | "Rajasthan Royals",
114 | ]
115 |
116 |
117 | heading_markdown = """
118 | # IPL Stats (2008-2019)
119 | ### by Bhola Prasad
120 | #### Website - [Life With Data](https://www.lifewithdata.com/)
121 | """
122 |
123 | # year list
124 | year_list = [year for year in range(2019, 2007, -1)]
125 |
126 | # players runs distribution plot
127 | runs_dist_plot = px.histogram(batting, x="Runs")
128 | runs_dist_plot.update_layout(title="Distribution of Player Runs(2008-2019)")
129 |
130 | # players runs kde plot
131 | import plotly.figure_factory as ff
132 |
133 | unique_teams = batting["Team"].unique()
134 |
135 | hist_data = [
136 | batting[batting["Team"] == team]["Runs"] for team in unique_teams if team != "Nan"
137 | ]
138 | group_labels = ["SRH", "KXIP", "MI", "DC", "KKR", "RCB", "CSK", "RR"]
139 | colors = ["Orange", "Silver", "Blue", "Black", "Gold", "Red", "Yellow", "Green"]
140 |
141 | runs_kde_plot = ff.create_distplot(
142 | hist_data, group_labels, show_hist=False, show_rug=False, colors=colors
143 | )
144 | runs_kde_plot.update_layout(
145 | title="Kde Plot of Runs", xaxis=dict(title="Runs"), yaxis=dict(title="Density")
146 | )
147 |
148 |
149 | # function for adding local images
150 | def encode_image(image_file):
151 | encoded = base64.b64encode(open(image_file, "rb").read())
152 | return "data:image/png;base64,{}".format(encoded.decode())
153 |
154 |
155 | # Batting Feature Importances figures
156 |
157 | batting_bar = os.getcwd() + "/images/batting_bar.png"
158 | batting_beeswarm = os.getcwd() + "/images/batting_beeswarm.png"
159 | batting_bf = os.getcwd() + "/images/batting_bf.png"
160 | batting_sr = os.getcwd() + "/images/batting_sr.png"
161 |
162 | # Bowling Feature Importances figures
163 | bowling_bar = os.getcwd() + "/images/bowling_bar.png"
164 | bowling_beeswarm = os.getcwd() + "/images/bowling_beeswarm.png"
165 | bowling_sr = os.getcwd() + "/images/bowling_sr.png"
166 | bowling_dots = os.getcwd() + "/images/bowling_dots.png"
167 |
168 |
169 | ###### Bowling plots
170 |
171 | # wickets histogram
172 | wickets_histogram = px.histogram(bowling, x="Wkts")
173 | wickets_histogram.update_layout(
174 | title="Number of Wickets In A Season(2008-2019)",
175 | yaxis=dict(title="Player Count"),
176 | xaxis=dict(title="Number Of Wickets"),
177 | )
178 |
179 | # wickets taken by teams distribution
180 | team_wickets_dist = px.box(bowling[bowling["Team"] != "Nan"], x="Wkts", y="Team")
181 | team_wickets_dist.update_layout(
182 | title="Wickets Taken Per Season (2008-2019)",
183 | yaxis=dict(title="Players Team"),
184 | xaxis=dict(title="Total Wickets"),
185 | )
186 |
187 | app = dash.Dash(__name__, external_stylesheets=[dbc.themes.SOLAR])
188 |
189 | server = app.server
190 |
191 |
192 | app.layout = html.Div(
193 | [
194 | html.H1("IPL Stats (2008-2019)"),
195 | html.H4("by Bhola Prasad"),
196 | dcc.Markdown("##### Website - [Life With Data](https://www.lifewithdata.com/)"),
197 | ##### Points Table
198 | html.Div([], style={"height": "100px"}),
199 | html.H3("Points Table"),
200 | html.Div(
201 | [
202 | html.Div(
203 | [
204 | html.Label("Select a Season"),
205 | dcc.Dropdown(
206 | id="points-year-selector",
207 | options=[
208 | {"label": str(year), "value": year}
209 | for year in year_list
210 | ],
211 | value=2019,
212 | ),
213 | ],
214 | style={"width": "20%", "display": "inline-block"},
215 | ),
216 | ]
217 | ),
218 | html.Div(
219 | [
220 | html.Div(
221 | [
222 | # points table data
223 | dash_table.DataTable(
224 | id="points-table",
225 | columns=[
226 | {"name": i, "id": i} for i in points_table.columns
227 | ],
228 | data=points_table.to_dict("records"),
229 | sort_action="native",
230 | style_cell={"textAlign": "left"},
231 | style_data_conditional=[
232 | {
233 | "if": {"row_index": "odd"},
234 | "backgroundColor": "rgb(248, 248, 248)",
235 | },
236 | {
237 | "if": {"column_id": "Team"},
238 | "backgroundColor": "#3D9970",
239 | "color": "white",
240 | },
241 | {
242 | "if": {
243 | "column_id": "Points",
244 | "row_index": [0, 1, 2, 3],
245 | },
246 | "backgroundColor": "#3D9970",
247 | "color": "white",
248 | },
249 | ],
250 | ),
251 | ],
252 | style={"margin": "15px", "width": "70%"},
253 | )
254 | ]
255 | ),
256 | ####### Team Wins and Losses Table
257 | html.Div([], style={"height": "45px"}),
258 | html.H3("Team Records"),
259 | html.Div(
260 | [
261 | dash_table.DataTable(
262 | id="wins-losses-table",
263 | columns=[{"name": i, "id": i} for i in wins_losses.columns],
264 | data=wins_losses.to_dict("records"),
265 | sort_action="native",
266 | style_cell={"textAlign": "left"},
267 | style_data_conditional=[
268 | {
269 | "if": {"row_index": "odd"},
270 | "backgroundColor": "rgb(248, 248, 248)",
271 | },
272 | {
273 | "if": {"column_id": "Team"},
274 | "backgroundColor": "#3D9970",
275 | "color": "white",
276 | },
277 | {
278 | "if": {"column_id": "Win %", "row_index": [0, 1]},
279 | "backgroundColor": "#3D9970",
280 | "color": "white",
281 | },
282 | {
283 | "if": {"column_id": "Titles", "row_index": [0, 1]},
284 | "backgroundColor": "#3D9970",
285 | "color": "white",
286 | },
287 | ],
288 | ),
289 | ],
290 | style={"margin": "15px", "width": "70%"},
291 | ),
292 | ###### Batting stats
293 | html.Div([], style={"height": "45px"}),
294 | html.H2("Batting Records"),
295 | html.Div(
296 | [
297 | html.Div([], style={"height": "25px"}),
298 | html.H4("Player Runs Per Season"),
299 | html.B("Select Players"),
300 | html.P("Use dropdown to select multiple players or remove them."),
301 | dcc.Dropdown(
302 | id="select-player-ts",
303 | options=[
304 | {"label": player, "value": player}
305 | for player in batting_players_list
306 | ],
307 | value=[
308 | "Virat Kohli",
309 | "Rohit Sharma",
310 | "David Warner",
311 | "KL Rahul",
312 | ],
313 | multi=True,
314 | ),
315 | # Players Runs Time-Series Chart
316 | dcc.Graph(id="players-runs-time-series"),
317 | ],
318 | style={"width": "70%"},
319 | ),
320 | ###### Runs Distributions
321 | html.Div([], style={"height": "45px"}),
322 | html.H3("Runs Distributions"),
323 | # Histogram of Runs Distributions
324 | html.Div(
325 | [
326 | html.Div(
327 | [
328 | html.P(
329 | "We can see that the distribution is right skewed. Many "
330 | "players makes low or medium runs, while few players makes "
331 | "lots of runs. The median of this distribution is 126 which "
332 | "means that 50% of the players makes less than 126 runs and "
333 | "50% more than this. 406 is the 90th percentile, meaning 90% "
334 | "of the players makes less than 406 runs. So, any players who "
335 | "is making more than 400 runs in a season is really doing well. "
336 | "They are in the top 10%."
337 | )
338 | ],
339 | style={
340 | "width": "30%",
341 | "display": "inline-block",
342 | "margin-top": "60px",
343 | },
344 | ),
345 | html.Div(
346 | [dcc.Graph(id="runs-dist-plot", figure=runs_dist_plot)],
347 | style={"width": "60%", "float": "right", "display": "inline-block"},
348 | ),
349 | ],
350 | style={"margin": "40px", "height": 500},
351 | ),
352 | # Kernal density estimation of Runs distributions
353 | html.Div(
354 | [
355 | html.Div(
356 | [
357 | html.P(
358 | "After segmenting the runs distribution by team, "
359 | "it is clear that percentage of players making runs "
360 | "within the 300 range is lower for csk compared to other "
361 | "teams and the higher within the range 300 to 600, which is "
362 | "what you want.Less percentage at the lower end and higher at "
363 | "the middle and upper end. On average, csk players make 235 "
364 | "runs,compared to 187 runs by Mumbai Indians which is the second "
365 | "highest."
366 | )
367 | ],
368 | style={
369 | "width": "30%",
370 | "display": "inline-block",
371 | "margin-top": "100px",
372 | },
373 | ),
374 | html.Div(
375 | [
376 | dcc.Graph(
377 | id="runs-kde-plot",
378 | figure=runs_kde_plot,
379 | )
380 | ],
381 | style={"width": "60%", "float": "right", "display": "inline-block"},
382 | ),
383 | ],
384 | style={"margin": "40px", "height": 500},
385 | ),
386 | # Batting Leaderboard - All Time
387 | html.H3("Batting Leaderboard"),
388 | html.Div([], style={"height": "25px"}),
389 | html.H4("All Time Records"),
390 | html.Div([], style={"height": "20px"}),
391 | html.Div(
392 | [
393 | dcc.Tabs(
394 | [
395 | dcc.Tab(
396 | label="Chart",
397 | children=[
398 | html.P(""),
399 | html.Div(
400 | [
401 | html.Div(
402 | [
403 | html.Label("Select a Metric"),
404 | dcc.Dropdown(
405 | id="all-time-metric-selector",
406 | options=[
407 | {
408 | "label": metric,
409 | "value": metric,
410 | }
411 | for metric in batting_metrics_list
412 | ],
413 | value="Runs",
414 | ),
415 | ],
416 | style={
417 | "width": "35%",
418 | "display": "inline-block",
419 | },
420 | ),
421 | html.Div(
422 | [
423 | html.Label("Select Team"),
424 | dcc.Dropdown(
425 | id="all-time-team-selector",
426 | options=[
427 | {
428 | "label": team,
429 | "value": team,
430 | }
431 | for team in team_list
432 | ],
433 | value="All Teams",
434 | ),
435 | ],
436 | style={
437 | "width": "35%",
438 | "float": "right",
439 | "display": "inline-block",
440 | },
441 | ),
442 | ]
443 | ),
444 | html.Div([dcc.Graph(id="all-time-graph")]),
445 | ],
446 | ),
447 | dcc.Tab(
448 | label="Table",
449 | children=[
450 | dash_table.DataTable(
451 | id="all-time-records",
452 | columns=[
453 | {"name": i, "id": i}
454 | for i in batting_agg.columns
455 | ],
456 | data=batting_agg.to_dict("records"),
457 | sort_action="native",
458 | style_cell={"textAlign": "left"},
459 | style_data_conditional=[
460 | {
461 | "if": {"row_index": "odd"},
462 | "backgroundColor": "rgb(248, 248, 248)",
463 | },
464 | ],
465 | style_table={"overflowX": "auto"},
466 | style_cell_conditional=[
467 | {
468 | "if": {"column_id": "PLAYER"},
469 | "textAlign": "center",
470 | },
471 | ],
472 | page_current=0,
473 | page_size=15,
474 | page_action="native",
475 | )
476 | ],
477 | ),
478 | ]
479 | )
480 | ],
481 | style={"width": "75%"},
482 | ),
483 | # Season Records
484 | html.Div([], style={"height": "45px"}),
485 | html.H4("Season Records"),
486 | html.Div([], style={"height": "20px"}),
487 | html.Div(
488 | [
489 | dcc.Tabs(
490 | [
491 | dcc.Tab(
492 | label="Chart",
493 | children=[
494 | html.P(""),
495 | html.Div(
496 | [
497 | html.Div(
498 | [
499 | html.Label("Select a Metric"),
500 | dcc.Dropdown(
501 | id="season-metric-selector",
502 | options=[
503 | {
504 | "label": metric,
505 | "value": metric,
506 | }
507 | for metric in batting_metrics_list
508 | ],
509 | value="Runs",
510 | ),
511 | ],
512 | style={
513 | "width": "25%",
514 | "float": "left",
515 | "padding-right": "25px",
516 | "display": "inline-block",
517 | },
518 | ),
519 | html.Div(
520 | [
521 | html.Label("Season"),
522 | dcc.Dropdown(
523 | id="season-year-selector",
524 | options=[
525 | {
526 | "label": str(year),
527 | "value": year,
528 | }
529 | for year in range(
530 | 2019, 2007, -1
531 | )
532 | ],
533 | value=2019,
534 | ),
535 | ],
536 | style={
537 | "width": "25%",
538 | "float": "middle",
539 | "display": "inline-block",
540 | },
541 | ),
542 | html.Div(
543 | [
544 | html.Label("Team"),
545 | dcc.Dropdown(
546 | id="season-team-selector",
547 | options=[
548 | {"label": team, "value": team}
549 | for team in team_list
550 | ],
551 | value="All Teams",
552 | ),
553 | ],
554 | style={
555 | "width": "25%",
556 | "float": "right",
557 | "display": "inline-block",
558 | },
559 | ),
560 | ],
561 | ),
562 | html.Div([dcc.Graph(id="season-graph")]),
563 | ],
564 | ),
565 | dcc.Tab(
566 | label="Table",
567 | children=[
568 | dash_table.DataTable(
569 | id="season-records",
570 | columns=[
571 | {"name": i, "id": i}
572 | for i in batting.columns
573 | if i != "Player Link"
574 | ],
575 | data=batting.to_dict("records"),
576 | sort_action="native",
577 | style_cell={"textAlign": "left"},
578 | style_data_conditional=[
579 | {
580 | "if": {"row_index": "odd"},
581 | "backgroundColor": "rgb(248, 248, 248)",
582 | },
583 | ],
584 | style_table={"overflowX": "auto"},
585 | style_cell_conditional=[
586 | {
587 | "if": {"column_id": "POS"},
588 | "textAlign": "center",
589 | },
590 | ],
591 | page_current=0,
592 | page_size=15,
593 | page_action="native",
594 | )
595 | ],
596 | ),
597 | ]
598 | )
599 | ],
600 | style={"width": "75%"},
601 | ),
602 | # Features importances
603 | html.Div([], style={"height": "80px"}),
604 | html.H4("Important features for predicting players runs."),
605 | html.Div([], style={"height": "25px"}),
606 | html.Div(
607 | [
608 | html.Div(
609 | [
610 | dcc.Tabs(
611 | id="tabs-with-classes",
612 | value="tab-1",
613 | parent_className="custom-tabs",
614 | className="custom-tabs-container",
615 | children=[
616 | dcc.Tab(
617 | label="Feature Importances",
618 | children=[html.Img(src=encode_image(batting_bar))],
619 | ),
620 | dcc.Tab(
621 | label="FI Beeswarm",
622 | children=[
623 | html.Img(src=encode_image(batting_beeswarm))
624 | ],
625 | ),
626 | dcc.Tab(
627 | label="Ball Faced",
628 | children=[html.Img(src=encode_image(batting_bf))],
629 | ),
630 | dcc.Tab(
631 | label="Strike Rate",
632 | children=[html.Img(src=encode_image(batting_sr))],
633 | ),
634 | ],
635 | )
636 | ],
637 | style={"width": "88%"},
638 | ),
639 | html.Div([], style={"height": "25px"}),
640 | html.Div(
641 | [
642 | html.H5("Feature Importances: "),
643 | html.P(
644 | "BF - This is the most important feature in predicting how much runs a player will make and"
645 | "as the number of ball faced increases the number of runs also increases, so spending more"
646 | "time on the field is even much more important than having a very higher strike rate. "
647 | ),
648 | html.P(
649 | "SR - Second most important feature is strike rate and having a higher strike rate is good."
650 | ),
651 | html.P(
652 | "4s and 6s - Hitting 4s is slightly more important than hitting 6s in making runs in the long "
653 | "run. The reason cloud be hitting 4s is much easier than hitting 6s so most of the time players "
654 | "tends to have more 4s than 6s and when added together, in the long run 4s generate more runs."
655 | ),
656 | html.P(
657 | "Avg - Batting avg is also important but not as much as the above mentioned metrics."
658 | ),
659 | ],
660 | style={"width": "85%"},
661 | ),
662 | ],
663 | style={"width": "75%"},
664 | ),
665 | # Bowling Records
666 | html.Div([], style={"height": "45px"}),
667 | html.H2("Bowling Records"),
668 | html.Div([], style={"height": "25px"}),
669 | html.H4("Player Wickets Per Season"),
670 | html.Div(
671 | [
672 | html.B("Select Players"),
673 | html.P(""),
674 | dcc.Dropdown(
675 | id="select-player-wkts-ts",
676 | options=[
677 | {"label": player, "value": player}
678 | for player in bowling_players_list
679 | ],
680 | value=[
681 | "Jasprit Bumrah",
682 | "Rashid Khan",
683 | "Kagiso Rabada",
684 | "Sunil Narine",
685 | "Deepak Chahar",
686 | ],
687 | multi=True,
688 | ),
689 | dcc.Graph(id="players-wickets-time-series"),
690 | ],
691 | style={"width": "70%"},
692 | ),
693 | html.Div([], style={"height": "45px"}),
694 | html.H4("Wickets Distributions"),
695 | # Histogram of Wickets Distributions
696 | html.Div(
697 | [
698 | html.Div(
699 | [
700 | html.P(
701 | "Just like runs, wickets distribution is also right skewed, means "
702 | "many players takes low or medium number of wickets, while few "
703 | "players takes lots of wickets.The median of this distribution is 5 "
704 | "which means that 50% of the players taks less than 5 wickets and "
705 | "50% more than 5 wickets. 15 is the 90th percentile, meaning 90% "
706 | "of the players takes less than 15 wickets. So, any players who "
707 | "is taking more than or equal to 15 wickets in a season is doing "
708 | "exceptionally well. "
709 | )
710 | ],
711 | style={
712 | "width": "30%",
713 | "display": "inline-block",
714 | "margin-top": "60px",
715 | },
716 | ),
717 | html.Div(
718 | [dcc.Graph(id="wickets-hist-plot", figure=wickets_histogram)],
719 | style={"width": "60%", "float": "right", "display": "inline-block"},
720 | ),
721 | ],
722 | style={"margin": "40px", "height": 500},
723 | ),
724 | # Team wickets distributions
725 | html.Div(
726 | [
727 | html.Div(
728 | [
729 | html.P(
730 | "On average, Chennai Super Kings bowlers also performs better "
731 | "than any other teams. Rajasthan Royals has some good balance in "
732 | "their team which is why their median wickets is second highest "
733 | "after CSK but overall gets outperformed by other teams. And there "
734 | "is lot of variability in Sunrisers hyderabad team, they have really "
735 | "some high wickets takers but the team is not much balanced which is "
736 | "why they have a very low median value. Out of all Royal Challengers "
737 | "Banglore and Delhi Capitals is performing very poorly. "
738 | )
739 | ],
740 | style={
741 | "width": "30%",
742 | "display": "inline-block",
743 | "margin-top": "100px",
744 | },
745 | ),
746 | html.Div(
747 | [
748 | dcc.Graph(
749 | id="team-wickets-dist",
750 | figure=team_wickets_dist,
751 | )
752 | ],
753 | style={"width": "60%", "float": "right", "display": "inline-block"},
754 | ),
755 | ],
756 | style={"margin": "40px", "height": 500},
757 | ),
758 | # Bowling Leaderboard
759 | html.H3("Bowling Leaderboard"),
760 | html.Div([], style={"height": "25px"}),
761 | html.H4("All Time Records"),
762 | html.Div([], style={"height": "20px"}),
763 | html.Div(
764 | [
765 | dcc.Tabs(
766 | [
767 | dcc.Tab(
768 | label="Chart",
769 | children=[
770 | html.P(""),
771 | html.Div(
772 | [
773 | html.Div(
774 | [
775 | html.Label("Select a Metric"),
776 | dcc.Dropdown(
777 | id="all-time-metric-selector-bowling",
778 | options=[
779 | {
780 | "label": metric,
781 | "value": metric,
782 | }
783 | for metric in bowling_metrics_list
784 | ],
785 | value="Wkts",
786 | ),
787 | ],
788 | style={
789 | "width": "35%",
790 | "display": "inline-block",
791 | },
792 | ),
793 | html.Div(
794 | [
795 | html.Label("Select Team"),
796 | dcc.Dropdown(
797 | id="all-time-team-selector-bowling",
798 | options=[
799 | {
800 | "label": team,
801 | "value": team,
802 | }
803 | for team in team_list
804 | ],
805 | value="All Teams",
806 | ),
807 | ],
808 | style={
809 | "width": "35%",
810 | "float": "right",
811 | "display": "inline-block",
812 | },
813 | ),
814 | ]
815 | ),
816 | html.Div([dcc.Graph(id="all-time-graph-bowling")]),
817 | ],
818 | ),
819 | dcc.Tab(
820 | label="Table",
821 | children=[
822 | dash_table.DataTable(
823 | id="all-time-records-bowling",
824 | columns=[
825 | {"name": i, "id": i}
826 | for i in bowling_agg.columns
827 | ],
828 | data=bowling_agg.to_dict("records"),
829 | sort_action="native",
830 | style_cell={
831 | "textAlign": "left",
832 | },
833 | style_data_conditional=[
834 | {
835 | "if": {"row_index": "odd"},
836 | "backgroundColor": "rgb(248, 248, 248)",
837 | },
838 | ],
839 | style_table={"overflowX": "auto"},
840 | style_cell_conditional=[
841 | {
842 | "if": {"column_id": "POS"},
843 | "textAlign": "center",
844 | },
845 | ],
846 | page_current=0,
847 | page_size=15,
848 | page_action="native",
849 | )
850 | ],
851 | ),
852 | ]
853 | )
854 | ],
855 | style={"width": "75%"},
856 | ),
857 | # Season Records - Bowling
858 | html.Div([], style={"height": "45px"}),
859 | html.H4("Season Records"),
860 | html.Div([], style={"height": "20px"}),
861 | html.Div(
862 | [
863 | dcc.Tabs(
864 | [
865 | dcc.Tab(
866 | label="Chart",
867 | children=[
868 | html.P(""),
869 | html.Div(
870 | [
871 | html.Div(
872 | [
873 | html.Label("Select a Metric"),
874 | dcc.Dropdown(
875 | id="season-metric-selector-bowling",
876 | options=[
877 | {
878 | "label": metric,
879 | "value": metric,
880 | }
881 | for metric in bowling_metrics_list
882 | ],
883 | value="Wkts",
884 | ),
885 | ],
886 | style={
887 | "width": "25%",
888 | "float": "left",
889 | "padding-right": "25px",
890 | "display": "inline-block",
891 | },
892 | ),
893 | html.Div(
894 | [
895 | html.Label("Season"),
896 | dcc.Dropdown(
897 | id="season-year-selector-bowling",
898 | options=[
899 | {
900 | "label": str(year),
901 | "value": year,
902 | }
903 | for year in range(
904 | 2019, 2007, -1
905 | )
906 | ],
907 | value=2019,
908 | ),
909 | ],
910 | style={
911 | "width": "25%",
912 | "float": "middle",
913 | "display": "inline-block",
914 | },
915 | ),
916 | html.Div(
917 | [
918 | html.Label("Team"),
919 | dcc.Dropdown(
920 | id="season-team-selector-bowling",
921 | options=[
922 | {"label": team, "value": team}
923 | for team in team_list
924 | ],
925 | value="All Teams",
926 | ),
927 | ],
928 | style={
929 | "width": "25%",
930 | "float": "right",
931 | "display": "inline-block",
932 | },
933 | ),
934 | ],
935 | ),
936 | html.Div([dcc.Graph(id="season-graph-bowling")]),
937 | ],
938 | ),
939 | dcc.Tab(
940 | label="Table",
941 | children=[
942 | dash_table.DataTable(
943 | id="season-records-bowling",
944 | columns=[
945 | {"name": i, "id": i}
946 | for i in bowling.columns
947 | if i != "Player Link"
948 | ],
949 | data=bowling.to_dict("records"),
950 | sort_action="native",
951 | style_cell={"textAlign": "left"},
952 | style_data_conditional=[
953 | {
954 | "if": {"row_index": "odd"},
955 | "backgroundColor": "rgb(248, 248, 248)",
956 | },
957 | ],
958 | style_table={"overflowX": "auto"},
959 | style_cell_conditional=[
960 | {
961 | "if": {"column_id": "POS"},
962 | "textAlign": "center",
963 | },
964 | ],
965 | page_current=0,
966 | page_size=15,
967 | page_action="native",
968 | )
969 | ],
970 | ),
971 | ]
972 | )
973 | ],
974 | style={"width": "75%"},
975 | ),
976 | # bowler Performance
977 | html.Div([], style={"height": "80px"}),
978 | html.H4("Important features for predicting bowlers wickets."),
979 | html.Div([], style={"height": "25px"}),
980 | html.Div(
981 | [
982 | html.Div(
983 | [
984 | dcc.Tabs(
985 | id="tabs-with-classes-bowling",
986 | parent_className="custom-tabs-bowling",
987 | className="custom-tabs-container-bowling",
988 | children=[
989 | dcc.Tab(
990 | label="Feature Importance",
991 | children=[html.Img(src=encode_image(bowling_bar))],
992 | ),
993 | dcc.Tab(
994 | label="FI Beeswarm",
995 | children=[
996 | html.Img(src=encode_image(bowling_beeswarm))
997 | ],
998 | ),
999 | dcc.Tab(
1000 | label="Strike Rate",
1001 | children=[html.Img(src=encode_image(bowling_sr))],
1002 | ),
1003 | dcc.Tab(
1004 | label="Dots",
1005 | children=[html.Img(src=encode_image(bowling_dots))],
1006 | ),
1007 | ],
1008 | ),
1009 | ],
1010 | style={"width": "82.5%"},
1011 | ),
1012 | html.Div([], style={"height": "25px"}),
1013 | html.Div(
1014 | [
1015 | html.H5("Faeture Importance: "),
1016 | html.P(
1017 | "Ov - This is the most important feature for predicting wickets, the reason could be that as you ball "
1018 | "more overs the chances of getting wickets also increase compared to someone who only balls few overs."
1019 | ),
1020 | html.P(
1021 | "SR - Second most important feature is the Strike rate which is the average no. of balls bowled "
1022 | "per wicket taken and it is negatively correlated with the wickets which means having a lower "
1023 | "value of SR is good. The most interesting thing to note here is that SR is more important than the Economy rate. "
1024 | "When people try to access a player performance, people often look at there Economy rate and If we "
1025 | "look at the above Feature importance plot, you can see that it has very little or not effect on the "
1026 | "no. of wickets taken which is really surprising."
1027 | ),
1028 | html.P(
1029 | "Dots- Another good feature is the number of dot balls a player balls. As the numbers of dot balls increase "
1030 | "the chances of taking wickets also increases."
1031 | ),
1032 | html.P(
1033 | "Avg - Bowling average is also an important feature. It is the average number of runs conceded per wickets and "
1034 | "it is negatively correlated with the wickets taken so having a lower Avg is good."
1035 | ),
1036 | html.P(
1037 | "Econ - Economy rate of a bowler is not so important compared to other metrics seen above if you are interested in "
1038 | "predicting wickets. It just tell you if a bowler is economically good or not means if he gives less or more Runs per over. "
1039 | "It doesn't say too much about a bowlers wicket taking capabilities."
1040 | ),
1041 | ],
1042 | style={"width": "80%"},
1043 | ),
1044 | ],
1045 | style={"width": "80%"},
1046 | ),
1047 | # summary
1048 | html.Div([], style={"height": "80px"}),
1049 | html.H3("Summary"),
1050 | html.Div([], style={"height": "25px"}),
1051 | html.Div(
1052 | [
1053 | html.P(
1054 | "1. Although Mumbai Indians won more titles than CSK, On average CSK players performs "
1055 | "better than MI. The average runs scored and wickets taken by CSK players is higher. "
1056 | ),
1057 | html.P(
1058 | "2. If a batsman is making more than 400 runs in a season and a bowler taking more "
1059 | "than 15 wickets in a season then their performance is really very good. They are doing "
1060 | "exceptionally well compared to others. "
1061 | ),
1062 | html.P(
1063 | "3. The most important features for predicting players runs are Ball Faced, Strike rate, "
1064 | "4s, 6s and Batting avg(for more information look at the above FI section)."
1065 | ),
1066 | html.P(
1067 | "4. Whether a players is indian or from overseas, it doesn't have any effect on the performance, "
1068 | "both tends to perform equally. We can't say overseas players are better than indian players."
1069 | ),
1070 | html.P(
1071 | "4. Important features for predicting wickets are bowlers Strike rate, Dots, Bowling average and "
1072 | "Economy. Although Economy rate of a bowler is not so important compared to other metrics mentioned "
1073 | "if you are interested in predicting wickets. It just tell you if a bowler is economically good or not "
1074 | "means if he gives less or more Runs per over. It doesn't say too much about a bowlers wicket taking capabilities "
1075 | "(see the Bowlers FI section for more info)."
1076 | ),
1077 | html.Div([], style={"height": "20px"}),
1078 | ],
1079 | style={"width": "65%"},
1080 | ),
1081 | ],
1082 | style={"margin-left": "20px"},
1083 | )
1084 |
1085 |
1086 | # update the points table
1087 | @app.callback(Output("points-table", "data"), [Input("points-year-selector", "value")])
1088 | def update_points_table(year):
1089 | dff = points_table[points_table["Season"] == year]
1090 | return dff.to_dict("records")
1091 |
1092 |
1093 | # update players runs time series chart
1094 | @app.callback(
1095 | Output("players-runs-time-series", "figure"), [Input("select-player-ts", "value")]
1096 | )
1097 | def update_players_runs_ts(player_names):
1098 | fig = go.Figure()
1099 | for player in player_names:
1100 | fig.add_trace(
1101 | go.Scatter(
1102 | x=batting[batting["PLAYER"] == player]["Season"],
1103 | y=batting[batting["PLAYER"] == player]["Runs"],
1104 | mode="lines",
1105 | name=player,
1106 | )
1107 | )
1108 | fig.add_shape(
1109 | # Line Horizontal
1110 | type="line",
1111 | x0=2008,
1112 | y0=406,
1113 | x1=2019,
1114 | y1=406,
1115 | line=dict(
1116 | color="LightSeaGreen",
1117 | width=2,
1118 | dash="dashdot",
1119 | ),
1120 | ),
1121 | fig.add_annotation(
1122 | text=" 90% of the players
makes less than 400 runs
in a season.",
1123 | x=2009,
1124 | y=406,
1125 | xref="x",
1126 | yref="y",
1127 | showarrow=True,
1128 | ax=0,
1129 | ay=-70,
1130 | )
1131 |
1132 | fig.update_layout(
1133 | xaxis=dict(title="Season"),
1134 | yaxis=dict(title="Runs"),
1135 | height=550,
1136 | )
1137 |
1138 | return fig
1139 |
1140 |
1141 | # All time Batting Graph
1142 | @app.callback(
1143 | Output("all-time-graph", "figure"),
1144 | [
1145 | Input("all-time-metric-selector", "value"),
1146 | Input("all-time-team-selector", "value"),
1147 | ],
1148 | )
1149 | def update_all_time_graph(metric, team):
1150 | df = batting_agg
1151 | if team == "All Teams":
1152 | df = df.sort_values(by=metric, ascending=False)
1153 | top_15 = df[:15]
1154 | fig = go.Figure()
1155 | fig.add_trace(go.Bar(x=top_15[metric], y=top_15["PLAYER"], orientation="h"))
1156 | fig.update_layout(
1157 | title="Top {} Players {} (2008-2019)".format(team, metric),
1158 | xaxis=dict(title="{}".format(metric)),
1159 | yaxis=dict(autorange="reversed"),
1160 | height=550,
1161 | )
1162 | return fig
1163 |
1164 | else:
1165 | team_df = batting[batting["Season"] == 2019][batting["Team"] == team]
1166 | # find all the unique players
1167 | unique_player_list = team_df["PLAYER"].unique()
1168 | # select only those players
1169 | df = df[df["PLAYER"].isin(unique_player_list)]
1170 | df = df.sort_values(by=metric, ascending=False)
1171 | fig = go.Figure()
1172 | fig.add_trace(
1173 | go.Bar(
1174 | x=df[metric],
1175 | y=df["PLAYER"],
1176 | orientation="h",
1177 | )
1178 | )
1179 | fig.update_layout(
1180 | title="Top {} Players {} (2008-2019)".format(team, metric),
1181 | xaxis=dict(title="{}".format(metric)),
1182 | yaxis=dict(autorange="reversed"),
1183 | height=550,
1184 | )
1185 | return fig
1186 |
1187 |
1188 | # sort the all time table based on the metric
1189 | @app.callback(
1190 | Output("all-time-records", "data"),
1191 | [
1192 | Input("all-time-metric-selector", "value"),
1193 | Input("all-time-team-selector", "value"),
1194 | ],
1195 | )
1196 | def update_all_time_table(metric, team):
1197 | df = batting_agg
1198 | if team == "All Teams":
1199 | df = df.sort_values(by=metric, ascending=False)
1200 | return df.to_dict("records")
1201 |
1202 | else:
1203 | team_df = batting[batting["Season"] == 2019][batting["Team"] == team]
1204 | # find all the unique players
1205 | unique_player_list = team_df["PLAYER"].unique()
1206 | # select only those players
1207 | df = df[df["PLAYER"].isin(unique_player_list)]
1208 | df = df.sort_values(by=metric, ascending=False)
1209 | return df.to_dict("records")
1210 |
1211 |
1212 | # Season batting graph
1213 | @app.callback(
1214 | Output("season-graph", "figure"),
1215 | [
1216 | Input("season-metric-selector", "value"),
1217 | Input("season-year-selector", "value"),
1218 | Input("season-team-selector", "value"),
1219 | ],
1220 | )
1221 | def update_batting_season_graph(metric, season, team):
1222 | df = batting[batting["Season"] == season]
1223 | if team == "All Teams":
1224 | df = df.sort_values(by=metric, ascending=False)
1225 | top_15 = df[:15]
1226 | fig = go.Figure()
1227 | fig.add_trace(
1228 | go.Bar(
1229 | x=top_15[metric],
1230 | y=top_15["PLAYER"],
1231 | orientation="h",
1232 | )
1233 | )
1234 | fig.update_layout(
1235 | title="Top {} Players {} ({})".format(team, metric, season),
1236 | xaxis=dict(title="{}".format(metric)),
1237 | yaxis=dict(autorange="reversed"),
1238 | height=550,
1239 | )
1240 | return fig
1241 | else:
1242 | df = df[df["Team"] == team]
1243 | df = df.sort_values(by=metric, ascending=False)
1244 | fig = go.Figure()
1245 | fig.add_trace(
1246 | go.Bar(
1247 | x=df[metric],
1248 | y=df["PLAYER"],
1249 | orientation="h",
1250 | )
1251 | )
1252 | fig.update_layout(
1253 | title="Top {} Players {} ({})".format(team, metric, season),
1254 | xaxis=dict(title="{}".format(metric)),
1255 | yaxis=dict(autorange="reversed"),
1256 | height=550,
1257 | )
1258 | return fig
1259 |
1260 |
1261 | # sort season batting table based on the metric and team, year
1262 | @app.callback(
1263 | Output("season-records", "data"),
1264 | [
1265 | Input("season-metric-selector", "value"),
1266 | Input("season-year-selector", "value"),
1267 | Input("season-team-selector", "value"),
1268 | ],
1269 | )
1270 | def update_season_batting_table(metric, season, team):
1271 | df = batting[batting["Season"] == season]
1272 | if team == "All Teams":
1273 | df = df.sort_values(by=metric, ascending=False)
1274 | return df.to_dict("records")
1275 |
1276 | else:
1277 | df = df[df["Team"] == team]
1278 | df = df.sort_values(by=metric, ascending=False)
1279 | return df.to_dict("records")
1280 |
1281 |
1282 | ######### Bowling stats
1283 |
1284 | # players wickets time series
1285 | @app.callback(
1286 | Output("players-wickets-time-series", "figure"),
1287 | [Input("select-player-wkts-ts", "value")],
1288 | )
1289 | def update_players_wickets_ts(player_names):
1290 | fig = go.Figure()
1291 | for player in player_names:
1292 | fig.add_trace(
1293 | go.Scatter(
1294 | x=bowling[bowling["PLAYER"] == player]["Season"],
1295 | y=bowling[bowling["PLAYER"] == player]["Wkts"],
1296 | mode="lines",
1297 | name=player,
1298 | )
1299 | )
1300 |
1301 | fig.update_layout(
1302 | title="Total Wickets In A Season(2008-2019)",
1303 | yaxis=dict(title="Total Wickets"),
1304 | xaxis=dict(title="Season"),
1305 | height=550,
1306 | )
1307 | return fig
1308 |
1309 |
1310 | # All time Bowling Graph
1311 | @app.callback(
1312 | Output("all-time-graph-bowling", "figure"),
1313 | [
1314 | Input("all-time-metric-selector-bowling", "value"),
1315 | Input("all-time-team-selector-bowling", "value"),
1316 | ],
1317 | )
1318 | def update_all_time_graph_bowling(metric, team):
1319 | df = bowling_agg
1320 | # Select only non-zero values
1321 | df = df[df[metric] != 0]
1322 | # reverse logic for these metrics, less is better
1323 | rev_metrics = ["Econ", "Avg", "SR", "Runs/Inns"]
1324 | if metric in rev_metrics:
1325 | asc = True
1326 | else:
1327 | asc = False
1328 |
1329 | if team == "All Teams":
1330 | df = df.sort_values(by=metric, ascending=asc)
1331 | top_15 = df[:15]
1332 | fig = go.Figure()
1333 | fig.add_trace(go.Bar(x=top_15[metric], y=top_15["PLAYER"], orientation="h"))
1334 | fig.update_layout(
1335 | title="Top {} Players {} (2008-2019)".format(team, metric),
1336 | xaxis=dict(title="{}".format(metric)),
1337 | yaxis=dict(autorange="reversed"),
1338 | height=550,
1339 | )
1340 | return fig
1341 |
1342 | else:
1343 | team_df = bowling[bowling["Season"] == 2019][bowling["Team"] == team]
1344 | # find all the unique players
1345 | unique_player_list = team_df["PLAYER"].unique()
1346 | # select only those players
1347 | df = df[df["PLAYER"].isin(unique_player_list)]
1348 | df = df.sort_values(by=metric, ascending=asc)
1349 | fig = go.Figure()
1350 | fig.add_trace(
1351 | go.Bar(
1352 | x=df[metric],
1353 | y=df["PLAYER"],
1354 | orientation="h",
1355 | )
1356 | )
1357 | fig.update_layout(
1358 | title="Top {} Players {} (2008-2019)".format(team, metric),
1359 | xaxis=dict(title="{}".format(metric)),
1360 | yaxis=dict(autorange="reversed"),
1361 | height=550,
1362 | )
1363 | return fig
1364 |
1365 |
1366 | # sort the all time bowling table based on the metric
1367 | @app.callback(
1368 | Output("all-time-records-bowling", "data"),
1369 | [
1370 | Input("all-time-metric-selector-bowling", "value"),
1371 | Input("all-time-team-selector-bowling", "value"),
1372 | ],
1373 | )
1374 | def update_all_time_table_bowling(metric, team):
1375 | df = bowling_agg
1376 | # Select only non-zero values
1377 | df = df[df[metric] != 0]
1378 | # reverse logic for these metrics, less is better
1379 | rev_metrics = ["Econ", "Avg", "SR", "Runs/Inns"]
1380 | if metric in rev_metrics:
1381 | asc = True
1382 | else:
1383 | asc = False
1384 |
1385 | if team == "All Teams":
1386 | df = df.sort_values(by=metric, ascending=asc)
1387 | return df.to_dict("records")
1388 |
1389 | else:
1390 | team_df = bowling[bowling["Season"] == 2019][bowling["Team"] == team]
1391 | # find all the unique players
1392 | unique_player_list = team_df["PLAYER"].unique()
1393 | # select only those players
1394 | df = df[df["PLAYER"].isin(unique_player_list)]
1395 | df = df.sort_values(by=metric, ascending=asc)
1396 | return df.to_dict("records")
1397 |
1398 |
1399 | # Season bowling graph
1400 | @app.callback(
1401 | Output("season-graph-bowling", "figure"),
1402 | [
1403 | Input("season-metric-selector-bowling", "value"),
1404 | Input("season-year-selector-bowling", "value"),
1405 | Input("season-team-selector-bowling", "value"),
1406 | ],
1407 | )
1408 | def update_batting_season_graph(metric, season, team):
1409 | df = bowling[bowling["Season"] == season]
1410 | # Select only non-zero values
1411 | df = df[df[metric] != 0]
1412 | rev_metrics = ["Econ", "Avg", "SR", "Runs/Inns"]
1413 | if metric in rev_metrics:
1414 | asc = True
1415 | else:
1416 | asc = False
1417 |
1418 | if team == "All Teams":
1419 | df = df.sort_values(by=metric, ascending=asc)
1420 | top_15 = df[:15]
1421 | fig = go.Figure()
1422 | fig.add_trace(
1423 | go.Bar(
1424 | x=top_15[metric],
1425 | y=top_15["PLAYER"],
1426 | orientation="h",
1427 | )
1428 | )
1429 | fig.update_layout(
1430 | title="Top {} Players {} ({})".format(team, metric, season),
1431 | xaxis=dict(title="{}".format(metric)),
1432 | yaxis=dict(autorange="reversed"),
1433 | height=550,
1434 | )
1435 | return fig
1436 | else:
1437 | df = df[df["Team"] == team]
1438 | df = df.sort_values(by=metric, ascending=asc)
1439 | fig = go.Figure()
1440 | fig.add_trace(
1441 | go.Bar(
1442 | x=df[metric],
1443 | y=df["PLAYER"],
1444 | orientation="h",
1445 | )
1446 | )
1447 | fig.update_layout(
1448 | title="Top {} Players {} ({})".format(team, metric, season),
1449 | xaxis=dict(title="{}".format(metric)),
1450 | yaxis=dict(autorange="reversed"),
1451 | height=550,
1452 | )
1453 | return fig
1454 |
1455 |
1456 | # sort season bowling table based on the metric and team, year
1457 | @app.callback(
1458 | Output("season-records-bowling", "data"),
1459 | [
1460 | Input("season-metric-selector-bowling", "value"),
1461 | Input("season-year-selector-bowling", "value"),
1462 | Input("season-team-selector-bowling", "value"),
1463 | ],
1464 | )
1465 | def update_season_batting_table(metric, season, team):
1466 | df = bowling[bowling["Season"] == season]
1467 | # Select only non-zero values
1468 | df = df[df[metric] != 0]
1469 | # reverse logic for these metrics, less is better
1470 | rev_metrics = ["Econ", "Avg", "SR", "Runs/Inns"]
1471 | if metric in rev_metrics:
1472 | asc = True
1473 | else:
1474 | asc = False
1475 |
1476 | if team == "All Teams":
1477 | df = df.sort_values(by=metric, ascending=asc)
1478 | return df.to_dict("records")
1479 |
1480 | else:
1481 | df = df[df["Team"] == team]
1482 | df = df.sort_values(by=metric, ascending=asc)
1483 | return df.to_dict("records")
1484 |
1485 |
1486 | if __name__ == "__main__":
1487 | app.run_server(debug=True)
1488 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | numpy==1.18.5
2 | pandas==1.0.5
3 | plotly==4.9.0
4 | dash==1.16.1
5 | gunicorn==20.0.4
6 | notebook==6.0.3
7 | beautifulsoup4==4.9.2
8 | requests==2.24.0
9 | matplotlib==3.2.2
10 | seaborn==0.10.1
11 | statsmodels==0.11.1
12 | dash-bootstrap-components==0.10.6
13 | nb_black==1.0.7
14 | lxml==4.5.2
--------------------------------------------------------------------------------
/wallpaper.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bprasad26/ipl_data_analysis/07b7a917561e20420fd018a64c89187369a3887f/wallpaper.jpg
--------------------------------------------------------------------------------
/web_scraping/web_scraping_script.py:
--------------------------------------------------------------------------------
1 | # import libraries
2 | import requests
3 | import numpy as np
4 | import pandas as pd
5 | from bs4 import BeautifulSoup as bs
6 | import time
7 | import random
8 | import re
9 | import os
10 |
11 |
12 | # Important Note ---
13 | # change the value for which you want to scrape the data defaults to 2008-2019
14 | year_list = [year for year in range(2019, 2007, -1)]
15 |
16 |
17 | # project paths
18 | project_root_dir = os.path.normpath(os.getcwd() + os.sep + os.pardir)
19 | file_path = os.path.join(project_root_dir, "data")
20 | os.makedirs(file_path, exist_ok=True)
21 |
22 | # function for loading data
23 | def load_data(filename, file_path=file_path):
24 | csv_path = os.path.join(file_path, filename)
25 | return pd.read_csv(csv_path)
26 |
27 |
28 | # function for saving data as csv file
29 | def save_dataframe(df, filename, file_path=file_path):
30 | """
31 | This function takes a dataframe and save it as a csv file.
32 |
33 | df: dataframe to save
34 | filename: Name to use for the csv file eg: 'my_file.csv'
35 | file_path = where to save the file
36 | """
37 | path = os.path.join(file_path, filename)
38 | df.to_csv(path, index=False)
39 |
40 |
41 | def get_batting_data(year):
42 | """This function gets the data from ipl official website,
43 | extract all the table data and return it as a pandas dataframe.
44 | """
45 | try:
46 | # get the html from the website
47 | url = "https://www.iplt20.com/stats/{}/most-runs".format(year)
48 | response = requests.get(url)
49 | batting_html = response.text
50 |
51 | # parse the html
52 | batting_soup = bs(batting_html, features="lxml")
53 | # get the table data
54 | batting_table_data = batting_soup.find(class_="js-table")
55 |
56 | # get the column names
57 | col_names = []
58 | for header in batting_table_data.find_all("th"):
59 | col_names.append(header.text.strip())
60 |
61 | # create the dataframe
62 | a_list = []
63 | for data in batting_table_data.find_all("td"):
64 | a_list.append(" ".join(data.text.split()))
65 |
66 | n = 14
67 | final = [a_list[i : i + n] for i in range(0, len(a_list), n)]
68 | df = pd.DataFrame(final)
69 | df.columns = col_names
70 |
71 | # Add the nationality of each player in the dataframe
72 | nationality_list = []
73 | for index, data in enumerate(batting_table_data.find_all("tr")[1:]):
74 | try:
75 | nationality_list.append(data["data-nationality"])
76 | except Exception as e:
77 | print(e)
78 | print(index)
79 | # add none
80 | nationality_list.append(None)
81 | df["Nationality"] = nationality_list
82 |
83 | # Add the player link for more info in the dataframe
84 | base_url = "https://www.iplt20.com"
85 | player_link_list = []
86 | try:
87 | # get all the links and add it to the list
88 | for data in batting_table_data.find_all("a"):
89 | player_link_list.append(base_url + data["href"])
90 |
91 | # create a column with None value
92 | df[15] = None
93 | # iterate through each row and create a player name pattern
94 | for index, row in df.iterrows():
95 | player_name = row["PLAYER"].replace(" ", "-")
96 | player_regex = re.compile(r"{}".format(player_name), re.IGNORECASE)
97 | for item in player_link_list:
98 | # if the pattern matches any links
99 | if player_regex.search(item) != None:
100 | # then append it to that row of the df
101 | df.iloc[index, 15] = item
102 | # rename the column
103 | df.rename(columns={15: "Player Link"}, inplace=True)
104 |
105 | # extract the player team name from the link and add to the df
106 | team_regex = r"teams/(\w+-\w+-?\w+)"
107 | df["Team"] = df["Player Link"].str.extract(team_regex, flags=re.IGNORECASE)
108 | df["Team"] = df["Team"].apply(lambda x: str(x).title().replace("-", " "))
109 |
110 | # convert data types from string to numeric
111 | df["POS"] = pd.to_numeric(df["POS"], errors="coerce").fillna(0)
112 | df["Mat"] = pd.to_numeric(df["Mat"], errors="coerce").fillna(0)
113 | df["Inns"] = pd.to_numeric(df["Inns"], errors="coerce").fillna(0)
114 | df["NO"] = pd.to_numeric(df["NO"], errors="coerce").fillna(0)
115 | df["Runs"] = pd.to_numeric(df["Runs"], errors="coerce").fillna(0)
116 | df["HS"] = pd.to_numeric(
117 | df["HS"].str.replace("*", ""), errors="coerce"
118 | ).fillna(0)
119 | df["Avg"] = pd.to_numeric(df["Avg"], errors="coerce").fillna(0)
120 | df["BF"] = pd.to_numeric(df["BF"], errors="coerce").fillna(0)
121 | df["SR"] = pd.to_numeric(df["SR"], errors="coerce").fillna(0)
122 | df["100"] = pd.to_numeric(df["100"], errors="coerce").fillna(0)
123 | df["50"] = pd.to_numeric(df["50"], errors="coerce").fillna(0)
124 | df["4s"] = pd.to_numeric(df["4s"], errors="coerce").fillna(0)
125 | df["6s"] = pd.to_numeric(df["6s"], errors="coerce").fillna(0)
126 |
127 | # Add season year
128 | df["Season"] = year
129 | except Exception as e:
130 | print(e)
131 | print(year)
132 |
133 | except Exception as e:
134 | print(e)
135 | print(year)
136 |
137 | # return the dataframe
138 | return df
139 |
140 |
141 | def combine_all_years_data(function, year_list):
142 | """
143 | Common function for combining data for all the years for a
144 | given table from ipl website or any other. All table have
145 | different functions to get the data from the websites.
146 | """
147 | try:
148 | # create an empty list to hold all the dataframes
149 | df_list = []
150 | # loop through each year and extract the data
151 | for year in year_list:
152 | # call the function to get the data for that year
153 | df = function(year)
154 | # append the data to the df list
155 | df_list.append(df)
156 | # add some random pause
157 | time.sleep(1 + 2 * random.random())
158 |
159 | # concat all the dataframes
160 | df = pd.concat(df_list, ignore_index=True)
161 |
162 | except Exception as e:
163 | print(e)
164 | print(year)
165 |
166 | # return the dataframe
167 | return df
168 |
169 |
170 | def get_points_table_data(year):
171 | """This Function takes the year value and extract the points table data
172 | from HowStat and return it as a Pandas Dataframe.
173 | """
174 |
175 | try:
176 | url = "http://www.howstat.com/cricket/Statistics/IPL/PointsTable.asp?s={}".format(
177 | year
178 | )
179 | response = requests.get(url)
180 | except Exception as e:
181 | print(e)
182 | print(year)
183 |
184 | try:
185 | # get the html text
186 | points_html_str = response.text
187 | # parse it using BeautifulSoup
188 | points_soup = bs(points_html_str, features="lxml")
189 | # Get all the Table data
190 | table_data = points_soup.find(class_="TableLined")
191 |
192 | # create an empty list
193 | a_list = []
194 | # loop through all the table data and extract the desired value and append
195 | # it to the empty list
196 | for data in table_data.find_all("td"):
197 | a_list.append(data.text.strip())
198 |
199 | # total item to put in a list as we have 10 columns
200 | n = 10
201 | # create a list of list each contains 10 items
202 | final = [a_list[i : i + n] for i in range(0, len(a_list), n)]
203 |
204 | # create a dataframe from the list of list
205 | df = pd.DataFrame(final)
206 | # set the column names which is in the 0th index
207 | df.columns = df.iloc[0]
208 | # drop the column names from the 0th index
209 | df = df.drop(df.index[0])
210 |
211 | # convert the data types of all the following columns
212 | col_to_convert = ["Mat", "Won", "Lost", "Tied", "N/R", "Points", "Net R/R"]
213 | # function for converting string to numerical values
214 | def convert_to_float(val):
215 | return float(val)
216 |
217 | # do the conversion for each column
218 | for col in col_to_convert:
219 | df[col] = df[col].apply(convert_to_float)
220 |
221 | # add season year
222 | df["Season"] = year
223 |
224 | except Exception as e:
225 | print(e)
226 | print("year:", year)
227 | print("Status Code:", response.status_code)
228 |
229 | # return the dataframe
230 | return df
231 |
232 |
233 | def get_series_matches_data(year):
234 | """This function takes the year value and returns the series match
235 | data.
236 | """
237 |
238 | try:
239 | url = "http://howstat.com/cricket/Statistics/IPL/SeriesMatches.asp?s={}".format(
240 | year
241 | )
242 | response = requests.get(url)
243 | except Exception as e:
244 | print(e)
245 | print(year)
246 |
247 | try:
248 | # get the html text
249 | series_match_html = response.text
250 | # parse the html text
251 | series_soup = bs(series_match_html, features="lxml")
252 | # get the table data
253 | series_table_data = series_soup.find(class_="TableLined")
254 | # an empty list and append all the data to it
255 | a_list = []
256 | for data in series_table_data.find_all("td"):
257 | a_list.append(data.text.strip())
258 |
259 | n = 4
260 | final = [a_list[i : i + n] for i in range(0, len(a_list), n)]
261 | df = pd.DataFrame(final)
262 | df.columns = df.iloc[0]
263 | df = df.drop(df.index[0])
264 |
265 | # convert to datetime object
266 | df["Date"] = pd.to_datetime(df["Date"])
267 | # split the match number and teams names
268 | df[["Match Number", "Teams"]] = df["Match"].str.split(":", expand=True)
269 | # get the team A and team B names
270 | df[["Team A", "Team B"]] = df["Teams"].str.split("v", expand=True)
271 |
272 | # matching pattern for team names
273 | team_regex = r"""
274 | (Rajasthan\sRoyals|Kings\sXI\sPunjab|Chennai\sSuper\sKings|Delhi\sCapitals|Mumbai\sIndians|
275 | Kolkata\sKnight\sRiders|Royal\sChallengers\sBangalore|Deccan\sChargers|Kochi\sTuskers\sKerala|
276 | Pune\sWarriors|Sunrisers\sHyderabad|Gujarat\sLions|Rising\sPune\sSupergiant|No\sresult|Match\sabandoned)
277 | """
278 | # Extract the data
279 | df["winner"] = df["Result"].str.extract(
280 | team_regex, flags=re.VERBOSE | re.IGNORECASE
281 | )
282 | df["Wins By Runs"] = (
283 | df["Result"]
284 | .str.extract(r"(\d{1,3})\s(Runs|Run)", flags=re.IGNORECASE)
285 | .fillna(0)
286 | .iloc[:, 0]
287 | )
288 | df["Wins By Wickets"] = (
289 | df["Result"]
290 | .str.extract(r"(\d{1,2})\s(Wickets|Wicket)", flags=re.IGNORECASE)
291 | .fillna(0)
292 | .iloc[:, 0]
293 | )
294 | df["Season"] = df["Date"].dt.year
295 |
296 | # columns to drop
297 | cols_to_drop = ["Match", "Teams", "Result"]
298 | df = df.drop(cols_to_drop, axis=1)
299 |
300 | # convert strings to int
301 | df["Wins By Runs"] = df["Wins By Runs"].astype("int")
302 | df["Wins By Wickets"] = df["Wins By Wickets"].astype("int")
303 |
304 | except Exception as e:
305 | print(e)
306 | print(year)
307 | print(response.status_code)
308 |
309 | # return the dataframe
310 | return df
311 |
312 |
313 | def get_fastest_fifties_data(year):
314 | """
315 | Get the fastest fifties data.
316 | """
317 | try:
318 | url = "https://www.iplt20.com/stats/{}/fastest-fifties".format(year)
319 | response = requests.get(url)
320 | fifties_html = response.text
321 | fifties_soup = bs(fifties_html, features="lxml")
322 | # get the table data
323 | fifties_table_data = fifties_soup.find(class_="js-table")
324 |
325 | # get the column names
326 | col_names = []
327 | for header in fifties_table_data.find_all("th"):
328 | col_names.append(header.text.strip())
329 |
330 | a_list = []
331 | for data in fifties_table_data.find_all("td"):
332 | a_list.append(" ".join(data.text.split()))
333 |
334 | n = 9
335 | final = [a_list[i : i + n] for i in range(0, len(a_list), n)]
336 | df = pd.DataFrame(final)
337 | df.columns = col_names
338 |
339 | # convert to datetime object
340 | df["Match Date"] = pd.to_datetime(df["Match Date"])
341 |
342 | # convert data types
343 | df["POS"] = pd.to_numeric(df["POS"], errors="coerce").fillna(0)
344 | df["BF"] = pd.to_numeric(df["BF"], errors="coerce").fillna(0)
345 | df["6s"] = pd.to_numeric(df["6s"], errors="coerce").fillna(0)
346 | df["4s"] = pd.to_numeric(df["4s"], errors="coerce").fillna(0)
347 | df["Runs"] = pd.to_numeric(df["Runs"], errors="coerce").fillna(0)
348 |
349 | # Add season year
350 | df["Season"] = year
351 |
352 | except Exception as e:
353 | print(e)
354 | print(year)
355 |
356 | return df
357 |
358 |
359 | def get_fastest_centuries_data(year):
360 | """
361 | Extract fastest centuries data for this year.
362 | """
363 | try:
364 | url = "https://www.iplt20.com/stats/{}/fastest-centuries".format(year)
365 | response = requests.get(url)
366 | centuries_html = response.text
367 | centuries_soup = bs(centuries_html, features="lxml")
368 | # get the table data
369 | centuries_table_data = centuries_soup.find(class_="js-table")
370 |
371 | # get the column names
372 | col_names = []
373 | for header in centuries_table_data.find_all("th"):
374 | col_names.append(header.text.strip())
375 |
376 | a_list = []
377 | for data in centuries_table_data.find_all("td"):
378 | a_list.append(" ".join(data.text.split()))
379 |
380 | n = 9
381 | final = [a_list[i : i + n] for i in range(0, len(a_list), n)]
382 | df = pd.DataFrame(final)
383 | df.columns = col_names
384 |
385 | # convert to datetime object
386 | df["Match Date"] = pd.to_datetime(df["Match Date"])
387 |
388 | # convert data from string to numeric
389 | df["POS"] = pd.to_numeric(df["POS"], errors="coerce").fillna(0)
390 | df["BF"] = pd.to_numeric(df["BF"], errors="coerce").fillna(0)
391 | df["6s"] = pd.to_numeric(df["6s"], errors="coerce").fillna(0)
392 | df["4s"] = pd.to_numeric(df["4s"], errors="coerce").fillna(0)
393 | df["Runs"] = pd.to_numeric(df["Runs"], errors="coerce").fillna(0)
394 |
395 | # add season year
396 | df["Season"] = year
397 |
398 | except Exception as e:
399 | print(e)
400 | print(year)
401 |
402 | return df
403 |
404 |
405 | def get_dot_balls_data(year):
406 | """This function gets the dot balls data for a particular year."""
407 | url = "https://www.iplt20.com/stats/{}/most-dot-balls".format(year)
408 | response = requests.get(url)
409 | dots_html = response.text
410 | dots_soup = bs(dots_html, features="lxml")
411 | dots_table_data = dots_soup.find(class_="js-table")
412 | # get the column names
413 | col_names = []
414 | for header in dots_table_data.find_all("th"):
415 | col_names.append(header.text.strip())
416 |
417 | a_list = []
418 | for data in dots_table_data.find_all("td"):
419 | a_list.append(" ".join(data.text.split()))
420 |
421 | n = 13
422 | final = [a_list[i : i + n] for i in range(0, len(a_list), n)]
423 | df = pd.DataFrame(final)
424 | df.columns = col_names
425 |
426 | # select only player name and Dots data
427 | df = df[["PLAYER", "Dots"]]
428 | # convert data type
429 | df["Dots"] = pd.to_numeric(df["Dots"], errors="coerce").fillna(0)
430 | return df
431 |
432 |
433 | def get_maidens_data(year):
434 | """This function gets the player name and maidens
435 | data for a particular year.
436 | """
437 | try:
438 | url = "https://www.iplt20.com/stats/{}/most-maidens".format(year)
439 | response = requests.get(url)
440 | maidens_html = response.text
441 | maidens_soup = bs(maidens_html, features="lxml")
442 | maidens_table_data = maidens_soup.find(class_="js-table")
443 | # get the column names
444 | col_names = []
445 | for header in maidens_table_data.find_all("th"):
446 | col_names.append(header.text.strip())
447 |
448 | a_list = []
449 | for data in maidens_table_data.find_all("td"):
450 | a_list.append(" ".join(data.text.split()))
451 |
452 | n = 13
453 | final = [a_list[i : i + n] for i in range(0, len(a_list), n)]
454 | df = pd.DataFrame(final)
455 | df.columns = col_names
456 |
457 | # select only player name and maid column
458 | df = df[["PLAYER", "Maid"]]
459 | # change data type
460 | df["Maid"] = pd.to_numeric(df["Maid"], errors="coerce").fillna(0)
461 |
462 | except Exception as e:
463 | print(e)
464 | print(year)
465 |
466 | return df
467 |
468 |
469 | def get_dots_maidens(year):
470 | """
471 | Combine the dots, maidens and data into a single df.
472 | """
473 | try:
474 | dots_df = get_dot_balls_data(year)
475 | maidens_df = get_maidens_data(year)
476 | # hats_df = get_hat_tricks_data(year)
477 |
478 | df = pd.merge(left=dots_df, right=maidens_df, how="left", on=["PLAYER"])
479 | # df = pd.merge(left=df, right=hats_df,how='left',on=['PLAYER'])
480 | # fill missing values
481 | df.fillna(0, inplace=True)
482 | except Exception as e:
483 | print(e)
484 | print(year)
485 |
486 | return df
487 |
488 |
489 | def get_bowling_data(year):
490 | try:
491 | url = "https://www.iplt20.com/stats/{}/most-wickets".format(year)
492 | response = requests.get(url)
493 | bowling_html = response.text
494 | bowling_soup = bs(bowling_html, features="lxml")
495 |
496 | # get the table data
497 | bowling_table_data = bowling_soup.find(class_="js-table")
498 |
499 | # get the column names
500 | col_names = []
501 | for header in bowling_table_data.find_all("th"):
502 | col_names.append(header.text.strip())
503 |
504 | a_list = []
505 | for data in bowling_table_data.find_all("td"):
506 | a_list.append(" ".join(data.text.split()))
507 |
508 | n = 13
509 | final = [a_list[i : i + n] for i in range(0, len(a_list), n)]
510 | df = pd.DataFrame(final)
511 | df.columns = col_names
512 |
513 | # Add the nationality of each player in the dataframe
514 | nationality_list = []
515 | for index, data in enumerate(bowling_table_data.find_all("tr")[1:]):
516 | try:
517 | nationality_list.append(data["data-nationality"])
518 | except Exception as e:
519 | print(e)
520 | print(index)
521 | # add none
522 | nationality_list.append(None)
523 | df["Nationality"] = nationality_list
524 |
525 | # Add the player link for more info in the dataframe
526 | base_url = "https://www.iplt20.com"
527 | player_link_list = []
528 |
529 | # get all the links and add it to the list
530 | for data in bowling_table_data.find_all("a"):
531 | player_link_list.append(base_url + data["href"])
532 |
533 | # create a column with None value
534 | df[14] = None
535 | # iterate through each row and create a player name pattern
536 | for index, row in df.iterrows():
537 | player_name = row["PLAYER"].replace(" ", "-")
538 | player_regex = re.compile(r"{}".format(player_name), re.IGNORECASE)
539 | for item in player_link_list:
540 | # if the pattern matches any links
541 | if player_regex.search(item) != None:
542 | # then append it to that row of the df
543 | df.iloc[index, 14] = item
544 | # rename the column
545 | df.rename(columns={14: "Player Link"}, inplace=True)
546 |
547 | # extract the player team name from the link and add to the df
548 | team_regex = r"teams/(\w+-\w+-?\w+)"
549 | df["Team"] = df["Player Link"].str.extract(team_regex, flags=re.IGNORECASE)
550 | df["Team"] = df["Team"].apply(lambda x: str(x).title().replace("-", " "))
551 |
552 | # convert data types from string to numeric
553 | df["POS"] = pd.to_numeric(df["POS"], errors="coerce").fillna(0)
554 | df["Mat"] = pd.to_numeric(df["Mat"], errors="coerce").fillna(0)
555 | df["Inns"] = pd.to_numeric(df["Inns"], errors="coerce").fillna(0)
556 | df["Ov"] = pd.to_numeric(df["Ov"], errors="coerce").fillna(0)
557 | df["Runs"] = pd.to_numeric(df["Runs"], errors="coerce").fillna(0)
558 | df["Wkts"] = pd.to_numeric(df["Wkts"], errors="coerce").fillna(0)
559 | df["BBI"] = pd.to_numeric(df["BBI"], errors="coerce").fillna(0)
560 | df["Avg"] = pd.to_numeric(df["Avg"], errors="coerce").fillna(0)
561 | df["Econ"] = pd.to_numeric(df["Econ"], errors="coerce").fillna(0)
562 | df["SR"] = pd.to_numeric(df["SR"], errors="coerce").fillna(0)
563 | df["4w"] = pd.to_numeric(df["4w"], errors="coerce").fillna(0)
564 | df["5w"] = pd.to_numeric(df["5w"], errors="coerce").fillna(0)
565 |
566 | # extract the dots balls and maidens data
567 | df2 = get_dots_maidens(year)
568 |
569 | # combine both the dataframes
570 | df = pd.merge(left=df, right=df2, how="left", on=["PLAYER"])
571 | # fill missing values
572 | df.fillna(0, inplace=True)
573 |
574 | # add season year
575 | df["Season"] = year
576 |
577 | except Exception as e:
578 | print(e)
579 | print(year)
580 |
581 | # return dataframe
582 | return df
583 |
584 |
585 | def get_wins_losses_data():
586 | win_losses = pd.read_html(
587 | "https://en.wikipedia.org/wiki/List_of_Indian_Premier_League_records_and_statistics"
588 | )
589 | # select the win losses table
590 | win_losses_df = win_losses[3]
591 | # drop the last
592 | win_losses_df.drop(win_losses_df.index[-1], inplace=True)
593 | # change names of the teams
594 | val_dict = {
595 | "CSK": "Chennai Super Kings",
596 | "DC": "Delhi Capitals",
597 | "KXIP": "Kings XI Punjab",
598 | "KKR": "Kolkata Knight Riders",
599 | "MI": "Mumbai Indians",
600 | "RR": "Rajasthan Royals",
601 | "RCB": "Royal Challengers Banglore",
602 | "SRH": "Sunrisers Hyderabad",
603 | }
604 |
605 | win_losses_df["Team"] = win_losses_df["Team"].map(val_dict)
606 | # rename the column
607 | win_losses_df.rename(columns={"Win\xa0%": "Win %"}, inplace=True)
608 | # columns list
609 | cols_list = [
610 | "Matches",
611 | "Won",
612 | "Lost",
613 | "No Result",
614 | "Tied and won",
615 | "Tied and lost",
616 | "Win %",
617 | "Titles",
618 | ]
619 | # convert data types
620 | for col in cols_list:
621 | win_losses_df[col] = pd.to_numeric(win_losses_df[col], errors="coerce").fillna(
622 | 0
623 | )
624 |
625 | return win_losses_df
626 |
627 |
628 | def batting_all_time_record(df):
629 | """This Function create the aggregated all the season data
630 | into a single dataframe.
631 | """
632 | agg_dict = {
633 | "Mat": "sum",
634 | "Inns": "sum",
635 | "NO": "sum",
636 | "Runs": "sum",
637 | "HS": "max",
638 | "Avg": "mean",
639 | "BF": "sum",
640 | "SR": "mean",
641 | "100": "sum",
642 | "50": "sum",
643 | "4s": "sum",
644 | "6s": "sum",
645 | }
646 | batting_all_time = (
647 | batting.groupby("PLAYER")
648 | .aggregate(agg_dict)
649 | .reset_index()
650 | .sort_values(by="Runs", ascending=False)
651 | )
652 | batting_all_time = batting_all_time.round(2)
653 |
654 | batting_all_time.index = np.arange(0, len(batting_all_time))
655 |
656 | return batting_all_time
657 |
658 |
659 | def get_bowling_data_all_time():
660 | try:
661 | url = "https://www.iplt20.com/stats/all-time/most-wickets"
662 | response = requests.get(url)
663 | bowling_html = response.text
664 | bowling_soup = bs(bowling_html, "lxml")
665 |
666 | # get the table data
667 | bowling_table_data = bowling_soup.find(class_="js-table")
668 |
669 | # get the column names
670 | col_names = []
671 | for header in bowling_table_data.find_all("th"):
672 | col_names.append(header.text.strip())
673 |
674 | a_list = []
675 | for data in bowling_table_data.find_all("td"):
676 | a_list.append(" ".join(data.text.split()))
677 |
678 | n = 13
679 | final = [a_list[i : i + n] for i in range(0, len(a_list), n)]
680 | df = pd.DataFrame(final)
681 | df.columns = col_names
682 |
683 | # Add the nationality of each player in the dataframe
684 | nationality_list = []
685 | for index, data in enumerate(bowling_table_data.find_all("tr")[1:]):
686 | try:
687 | nationality_list.append(data["data-nationality"])
688 | except Exception as e:
689 | print(e)
690 | print(index)
691 | # add none
692 | nationality_list.append(None)
693 | df["Nationality"] = nationality_list
694 |
695 | # Add the player link for more info in the dataframe
696 | base_url = "https://www.iplt20.com"
697 | player_link_list = []
698 |
699 | # get all the links and add it to the list
700 | for data in bowling_table_data.find_all("a"):
701 | player_link_list.append(base_url + data["href"])
702 |
703 | # create a column with None value
704 | df[14] = None
705 | # iterate through each row and create a player name pattern
706 | for index, row in df.iterrows():
707 | player_name = row["PLAYER"].replace(" ", "-")
708 | player_regex = re.compile(r"{}".format(player_name), re.IGNORECASE)
709 | for item in player_link_list:
710 | # if the pattern matches any links
711 | if player_regex.search(item) != None:
712 | # then append it to that row of the df
713 | df.iloc[index, 14] = item
714 | # rename the column
715 | df.rename(columns={14: "Player Link"}, inplace=True)
716 |
717 | # extract the player team name from the link and add to the df
718 | team_regex = r"teams/(\w+-\w+-?\w+)"
719 | df["Team"] = df["Player Link"].str.extract(team_regex, flags=re.IGNORECASE)
720 | df["Team"] = df["Team"].apply(lambda x: str(x).title().replace("-", " "))
721 |
722 | # convert data types from string to numeric
723 | df["POS"] = pd.to_numeric(df["POS"], errors="coerce").fillna(0)
724 | df["Mat"] = pd.to_numeric(df["Mat"], errors="coerce").fillna(0)
725 | df["Inns"] = pd.to_numeric(df["Inns"], errors="coerce").fillna(0)
726 | df["Ov"] = pd.to_numeric(df["Ov"], errors="coerce").fillna(0)
727 | df["Runs"] = pd.to_numeric(
728 | df["Runs"].str.replace(",", ""), errors="coerce"
729 | ).fillna(0)
730 | df["Wkts"] = pd.to_numeric(df["Wkts"], errors="coerce").fillna(0)
731 | # df['BBI'] = pd.to_numeric(df['BBI'], errors='coerce').fillna(0)
732 | df["Avg"] = pd.to_numeric(df["Avg"], errors="coerce").fillna(0)
733 | df["Econ"] = pd.to_numeric(df["Econ"], errors="coerce").fillna(0)
734 | df["SR"] = pd.to_numeric(df["SR"], errors="coerce").fillna(0)
735 | df["4w"] = pd.to_numeric(df["4w"], errors="coerce").fillna(0)
736 | df["5w"] = pd.to_numeric(df["5w"], errors="coerce").fillna(0)
737 |
738 | except Exception as e:
739 | print(e)
740 | print(year)
741 |
742 | # return dataframe
743 | return df
744 |
745 |
746 | if __name__ == "__main__":
747 |
748 | # get the points table data
749 | print()
750 | print("Getting Points table data.")
751 | points_table_df = combine_all_years_data(get_points_table_data, year_list)
752 | # save the data
753 | save_dataframe(points_table_df, "points_table.csv", file_path)
754 | print("completed")
755 | print()
756 |
757 | # get series matches data
758 | print("Getting Series Matches Data.")
759 | series_matches_df = combine_all_years_data(get_series_matches_data, year_list)
760 | save_dataframe(series_matches_df, "series_matches.csv", file_path)
761 | print("Completed")
762 | print()
763 |
764 | # get batting data
765 | print("Getting Batting Data")
766 | batting_df = combine_all_years_data(get_batting_data, year_list)
767 | save_dataframe(batting_df, "batting.csv", file_path)
768 | print("Completed")
769 | print()
770 |
771 | # create batting aggregated data
772 | print("Creating batting aggregated data")
773 | batting = load_data("batting.csv")
774 | batting_all_time = batting_all_time_record(batting)
775 | save_dataframe(batting_all_time, "batting_all_time.csv", file_path)
776 | print("Completed")
777 | print()
778 |
779 | # get fastest fifties data
780 | print("Getting Fastest Fifties Data.")
781 | fastest_fifties_df = combine_all_years_data(get_fastest_fifties_data, year_list)
782 | save_dataframe(fastest_fifties_df, "fastest_fifties.csv", file_path)
783 | print("Completed")
784 | print()
785 |
786 | # get fastest centuries data
787 | print("Getting Fastest Centuries Data.")
788 | fastest_centuries_df = combine_all_years_data(get_fastest_centuries_data, year_list)
789 | save_dataframe(fastest_centuries_df, "fastest_centuries.csv", file_path)
790 | print("Completed")
791 | print()
792 |
793 | # get wins losses data
794 | print("Getting Wins Losses Data")
795 | wins_losses_df = get_wins_losses_data()
796 | save_dataframe(wins_losses_df, "wins_losses.csv", file_path)
797 | print("Completed")
798 | print()
799 |
800 | # get bowling data
801 | print("Getting Bowling Data")
802 | bowling_df = combine_all_years_data(get_bowling_data, year_list)
803 | save_dataframe(bowling_df, "bowling.csv", file_path)
804 | print("Completed.")
805 | print()
806 |
807 | # get bowling data all time
808 | print("Getting bowling aggregated data")
809 | bowling_all_time = get_bowling_data_all_time()
810 | save_dataframe(bowling_all_time, "bowling_all_time.csv", file_path)
811 | print("Completed")
812 | print()
813 | print("I am done! Have Fun :)")
814 |
815 |
--------------------------------------------------------------------------------