#loading the required libraries
import pandas as pd
from matplotlib import pyplot as plt
#import seaborn as sns
#loading the ipl dataset
ipl=pd.read_csv('ipl_2023_dataset.csv')
#having a glance at records of the dataset
ipl
Unnamed: 0 | Player Name | Type | Price Cr | Team | |
---|---|---|---|---|---|
0 | 0 | Ben Stokes | All-Rounder | 16.25 | Chennai Super Kings |
1 | 1 | Ravindra Jadeja | All-Rounder | 16.00 | Chennai Super Kings |
2 | 2 | Deepak Chahar | Bowler | 14.00 | Chennai Super Kings |
3 | 3 | MS Dhoni | Wicket-Keeper | 12.00 | Chennai Super Kings |
4 | 4 | Moeen Ali | All-Rounder | 8.00 | Chennai Super Kings |
... | ... | ... | ... | ... | ... |
563 | 563 | Dhruv Patel | All-Rounder | NaN | Unsold |
564 | 564 | Jack Prestwidge | All-Rounder | NaN | Unsold |
565 | 565 | Aditya Sarvate | All-Rounder | NaN | Unsold |
566 | 566 | Sagar Solanki | All-Rounder | NaN | Unsold |
567 | 567 | Prenelan Subrayen | All-Rounder | NaN | Unsold |
568 rows × 5 columns
#Looking at the number of rows(no. of palyers) and columns in dataset
ipl.shape
(568, 5)
#Getting the frequency of players in a team
ipl['Team'].value_counts()
Unsold 325 Chennai Super Kings 25 Delhi Capitals 25 Gujarat Titans 25 Lucknow Super Giants 25 Royal Challengers Bangalore 25 Rajasthan Royals 25 Sunrisers Hyderabad 25 Mumbai Indians 24 Kolkata Knight Riders 22 Punjab Kings 22 Name: Team, dtype: int64
#Extracting the records where a team has a player equal to or with a higher value than 10 Cr.
ipl[ipl['Price Cr']>=10]
Unnamed: 0 | Player Name | Type | Price Cr | Team | |
---|---|---|---|---|---|
0 | 0 | Ben Stokes | All-Rounder | 16.25 | Chennai Super Kings |
1 | 1 | Ravindra Jadeja | All-Rounder | 16.00 | Chennai Super Kings |
2 | 2 | Deepak Chahar | Bowler | 14.00 | Chennai Super Kings |
3 | 3 | MS Dhoni | Wicket-Keeper | 12.00 | Chennai Super Kings |
25 | 25 | Rishabh Pant | Wicket-Keeper | 16.00 | Delhi Capitals |
26 | 26 | Axar Patel | All-Rounder | 12.00 | Delhi Capitals |
50 | 50 | Hardik Pandya | All-Rounder | 15.00 | Gujarat Titans |
51 | 51 | Rashid Khan | Bowler | 15.00 | Gujarat Titans |
75 | 75 | Andre Russell | All-Rounder | 16.00 | Kolkata Knight Riders |
76 | 76 | Shreyas Iyer | Batter | 12.25 | Kolkata Knight Riders |
77 | 77 | Varun Chakaravarthy | Bowler | 12.00 | Kolkata Knight Riders |
78 | 78 | Shardul Thakur | Bowler | 10.75 | Kolkata Knight Riders |
79 | 79 | Lockie Ferguson | Bowler | 10.00 | Kolkata Knight Riders |
97 | 97 | KL Rahul | Batter | 17.00 | Lucknow Super Giants |
98 | 98 | Nicholas Pooran | Wicket-Keeper | 16.00 | Lucknow Super Giants |
99 | 99 | Avesh Khan | Bowler | 10.00 | Lucknow Super Giants |
100 | 100 | Marcus Stoinis | All-Rounder | 10.00 | Lucknow Super Giants |
122 | 122 | Cameron Green | All-Rounder | 17.50 | Mumbai Indians |
123 | 123 | Rohit Sharma | Batter | 16.00 | Mumbai Indians |
124 | 124 | Ishan Kishan | Wicket-Keeper | 15.25 | Mumbai Indians |
125 | 125 | Jasprit Bumrah | Bowler | 12.00 | Mumbai Indians |
146 | 146 | Sam Curran | All-Rounder | 18.50 | Punjab Kings |
147 | 147 | Liam Livingstone | All-Rounder | 11.50 | Punjab Kings |
168 | 168 | Virat Kohli | Batter | 15.00 | Royal Challengers Bangalore |
169 | 169 | Glenn Maxwell | All-Rounder | 11.00 | Royal Challengers Bangalore |
170 | 170 | Harshal Patel | Bowler | 10.75 | Royal Challengers Bangalore |
171 | 171 | Wanindu Hasaranga | All-Rounder | 10.75 | Royal Challengers Bangalore |
193 | 193 | Sanju Samson | Wicket-Keeper | 14.00 | Rajasthan Royals |
194 | 194 | Prasidh Krishna | Bowler | 10.00 | Rajasthan Royals |
195 | 195 | Jos Buttler | Wicket-Keeper | 10.00 | Rajasthan Royals |
218 | 218 | Harry Brook | Batter | 13.25 | Sunrisers Hyderabad |
#ipl team, with their market values in descending order
ipl.groupby('Team')['Price Cr'].sum().sort_values(ascending=False)
Team Mumbai Indians 94.95 Chennai Super Kings 93.50 Kolkata Knight Riders 93.35 Royal Challengers Bangalore 93.25 Rajasthan Royals 91.65 Lucknow Super Giants 91.45 Delhi Capitals 90.55 Gujarat Titans 90.55 Sunrisers Hyderabad 88.45 Punjab Kings 82.80 Unsold 0.00 Name: Price Cr, dtype: float64
plt.bar(list(ipl['Price Cr'][0:5].keys()),list(ipl['Price Cr'][0:5]),color=["blue","yellow","purple","red","pink"])
plt.xticks([0, 1, 2, 3, 4], ['MI', 'CSK', 'KKR','PK','RR'])
plt.xlabel('Teams')
plt.ylabel('Prices')
plt.show()
#Most expensive ten players in the list
ipl.nlargest(10, 'Price Cr')
Unnamed: 0 | Player Name | Type | Price Cr | Team | |
---|---|---|---|---|---|
146 | 146 | Sam Curran | All-Rounder | 18.50 | Punjab Kings |
122 | 122 | Cameron Green | All-Rounder | 17.50 | Mumbai Indians |
97 | 97 | KL Rahul | Batter | 17.00 | Lucknow Super Giants |
0 | 0 | Ben Stokes | All-Rounder | 16.25 | Chennai Super Kings |
1 | 1 | Ravindra Jadeja | All-Rounder | 16.00 | Chennai Super Kings |
25 | 25 | Rishabh Pant | Wicket-Keeper | 16.00 | Delhi Capitals |
75 | 75 | Andre Russell | All-Rounder | 16.00 | Kolkata Knight Riders |
98 | 98 | Nicholas Pooran | Wicket-Keeper | 16.00 | Lucknow Super Giants |
123 | 123 | Rohit Sharma | Batter | 16.00 | Mumbai Indians |
124 | 124 | Ishan Kishan | Wicket-Keeper | 15.25 | Mumbai Indians |
#team RR
ipl[ipl['Team'] == 'Rajasthan Royals']
Unnamed: 0 | Player Name | Type | Price Cr | Team | |
---|---|---|---|---|---|
193 | 193 | Sanju Samson | Wicket-Keeper | 14.00 | Rajasthan Royals |
194 | 194 | Prasidh Krishna | Bowler | 10.00 | Rajasthan Royals |
195 | 195 | Jos Buttler | Wicket-Keeper | 10.00 | Rajasthan Royals |
196 | 196 | Shimron Hetmyer | Batter | 8.50 | Rajasthan Royals |
197 | 197 | Trent Boult | Bowler | 8.00 | Rajasthan Royals |
198 | 198 | Devdutt Padikkal | Batter | 7.75 | Rajasthan Royals |
199 | 199 | Yuzvendra Chahal | Bowler | 6.50 | Rajasthan Royals |
200 | 200 | Jason Holder | All-Rounder | 5.75 | Rajasthan Royals |
201 | 201 | Ravichandran Ashwin | All-Rounder | 5.00 | Rajasthan Royals |
202 | 202 | Yashasvi Jaiswal | Batter | 4.00 | Rajasthan Royals |
203 | 203 | Riyan Parag | Batter | 3.80 | Rajasthan Royals |
204 | 204 | Navdeep Saini | Bowler | 2.60 | Rajasthan Royals |
205 | 205 | Adam Zampa | Bowler | 1.50 | Rajasthan Royals |
206 | 206 | Joe Root | Batter | 1.00 | Rajasthan Royals |
207 | 207 | Obed McCoy | Bowler | 0.75 | Rajasthan Royals |
208 | 208 | D Ferreira | Wicket-Keeper | 0.50 | Rajasthan Royals |
209 | 209 | KM Asif | Bowler | 0.30 | Rajasthan Royals |
210 | 210 | KC Cariappa | Bowler | 0.30 | Rajasthan Royals |
211 | 211 | Kuldeep Sen | Bowler | 0.20 | Rajasthan Royals |
212 | 212 | Dhruv Jurel | Wicket-Keeper | 0.20 | Rajasthan Royals |
213 | 213 | Kunal Singh Rathore | Wicket-Keeper | 0.20 | Rajasthan Royals |
214 | 214 | Abdul Basith | All-Rounder | 0.20 | Rajasthan Royals |
215 | 215 | Akash Vasisht | All-Rounder | 0.20 | Rajasthan Royals |
216 | 216 | Murugan Ashwin | Bowler | 0.20 | Rajasthan Royals |
217 | 217 | Kuldip Yadav | Bowler | 0.20 | Rajasthan Royals |
#All-rounders in rajasthan royals
ipl[(ipl['Type'] == 'All-Rounder') & (ipl['Team'] == 'Rajasthan Royals')]
Unnamed: 0 | Player Name | Type | Price Cr | Team | |
---|---|---|---|---|---|
200 | 200 | Jason Holder | All-Rounder | 5.75 | Rajasthan Royals |
201 | 201 | Ravichandran Ashwin | All-Rounder | 5.00 | Rajasthan Royals |
214 | 214 | Abdul Basith | All-Rounder | 0.20 | Rajasthan Royals |
215 | 215 | Akash Vasisht | All-Rounder | 0.20 | Rajasthan Royals |
Want me to add some more details then do message me over my gmail or WhatsApp ID