<jupyter_start><jupyter_text>I got a file a data set of all cricket players which was scrapped from cricinfo on kaggle. I don't want to use all of it and will focus on only Indian players who played international matches for India A.<jupyter_code># Importing libraries i'll require
import pandas as pd
import matplotlib.pyplot as plt
cd = pd.read_csv('cricket_data.csv')
cd.shape
cd.head(5)<jupyter_output><empty_output><jupyter_text>That's a good sized dataset, let's see what all columns we have.<jupyter_code>#pd.set_option('display.max_rows',181) #Setting display size as output is more than default 10
cd.dtypes<jupyter_output><empty_output><jupyter_text>I don't need all those columns, let's take only what we think is needed.<jupyter_code>cd = cd[['NAME','COUNTRY','Major teams','Playing role',
    'BATTING_T20Is_Inns','BATTING_T20Is_Runs','BATTING_T20Is_Ave','BATTING_T20Is_100','BATTING_T20Is_50',
    'BOWLING_T20Is_Inns','BOWLING_T20Is_Ave','BOWLING_T20Is_Econ','BOWLING_T20Is_SR']]<jupyter_output><empty_output><jupyter_text>I am looking for only Indian players so let's remove other nationality players first.<jupyter_code>cd = cd[cd['COUNTRY']=='India']
cd.shape<jupyter_output><empty_output><jupyter_text>We already reduced from 90K to 13K, lets look at only international players.<jupyter_code>cd[cd['Major teams']=='India A']<jupyter_output><empty_output><jupyter_text>Odd i was expecting results, so the team column has a list of teams a player has played for and it can't just India A. Can't filter it directly.<jupyter_code>cd = cd[cd['Major teams'].isna()==False] #removing players with no teams
cd = cd[cd['Major teams'].str.contains('India A') & cd['Major teams'].str.contains('Women')==False]<jupyter_output><empty_output><jupyter_text>Many indian players we selected haven't played a T20 international. Let's remove them.<jupyter_code>indianT20Players=cd[ (cd['BOWLING_T20Is_Inns'].isna()==False) | (cd['BATTING_T20Is_Inns'].isna()==False) ]
indianT20Players.to_csv('IndianT20IPlayers.csv')
indianT20Players.shape<jupyter_output><empty_output><jupyter_text>41 players o.0I checked again the dataset is at issue, it's old, doesn't have all values for all players. We have treated it the best way we can.<jupyter_code>indianT20Players
indianT20Players.describe()
plt.figure(figsize=(25,5))
batsorted = indianT20Players[['NAME','BATTING_T20Is_Inns']].sort_values('BATTING_T20Is_Inns')
plt.bar(batsorted['NAME'],batsorted['BATTING_T20Is_Inns'])<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup