<jupyter_start><jupyter_text>Out of 24 matches held between DC and MI compared in twoscenarios, In both of the cases, both stands level. Its surely gonna be an exciting start for the playoff!<jupyter_code>def statistics_for_lists(lst):
  print("Maximum Value Of List:")
  print(max(lst))
  print("Median of the List:")
  print(statistics.median(lst))
  print("Mean of the List:")
  print(statistics.mean(lst))
  print("75% of the Median is:")
  print(statistics.median_high(lst))
  print("Minimum Value of List:")
  print(min(lst))
deliveries = pd.read_csv("/content/sample_data/deliveries.csv")
deliveries.head()
dropToBeList = ['inning','is_super_over','bye_runs','legbye_runs','fielder']
deliveries.drop(dropToBeList, axis=1, inplace=True)
deliveries.replace(['Deccan Chargers','Delhi Daredevils'],['Sunrisers Hyderabad','Delhi Capitals'],inplace=True,regex=True)
deliveries['dismissal_kind'].fillna('Not Out',inplace=True)
deliveries.head()
ballbyball = deliveries[((deliveries.batting_team=="Mumbai Indians") & (deliveries.bowling_team=='Sunrisers Hyderabad')) | ((deliveries.batting_team=='Sunrisers Hyderabad') & (deliveries.bowling_team=="Mumbai Indians"))]
no_of_matches=list(set([i for i in ballbyball['match_id']]))
no_of_matches.sort()
print(len(no_of_matches))
#Q2
no_of_wickets_fall = ballbyball[(ballbyball.dismissal_kind != 'Not Out') & (ballbyball.over>=1) & (ballbyball.over<=5)].groupby('match_id').dismissal_kind.count()
no_of_wickets_fall.describe()<jupyter_output><empty_output><jupyter_text>There is on an average, chance of fall of 2 to 3 wickets in this match's powerplay overall!<jupyter_code>#Q5
bumrah = deliveries[(deliveries.bowler=='JJ Bumrah') & (deliveries.over>=15) & (deliveries.over<=20)]
matches_by_bumrah = list(set([i for i in bumrah['match_id']]))
ecr = [] 
for i in matches_by_bumrah:
  df = bumrah[bumrah.match_id==i]
  balls = df.shape[0]
  if(balls>=24):
    balls = 4
  elif(balls>=18):
    balls = 3
  elif(balls>=12):
    balls = 2
  elif(balls>=6):
    balls=1
  runs_given = df['total_runs'].sum()
  if(balls==0):
    continue
  else: 
    er = runs_given/balls
    ecr.append(er)
print(ecr)
statistics_for_lists(ecr)<jupyter_output>[12.5, 8.5, 14.0, 14.0, 16.0, 16.0, 11.0, 5.5, 4.0, 6.0, 17.0, 9.0, 10.0, 5.5, 14.5, 9.0, 7.0, 10.5, 13.0, 4.5, 9.0, 12.5, 8.0, 11.5, 10.0, 5.0, 12.0, 8.0, 25.0, 16.0, 6.0, 11.0, 5.0, 7.5, 9.0, 6.5, 6.5, 9.5, 5.0, 12.0, 16.5, 11.0, 9.0, 9.5, 11.666666666666666, 6.0, 7.5, 14.5, 8.333333333333334, 5.0, 9.0, 8.0, 9.0, 7.5, 9.0, 13.0, 8.5, 9.0, 8.0, 10.0, 7.5, 3.0, 3.0, 12.5, 6.0, 9.5, 10.0, 5.0, 7.333333333333333, 14.5, 10.5]
Maximum Value Of List:
25.0
Median of the List:
9.0
Mean of the List:
9.5962441314554
75% of the Median is:
9.0
Minimum Value of List:
3.0<jupyter_text>Though the above stats are inclined towards nine, I prefer 6 to 7 as his consistency is tremendous in this season of ipl<jupyter_code>#Q4
batsman_morethan_30 = []
for i in no_of_matches:
  df = ballbyball[ballbyball.match_id==i]
  lst_batsman = list(set([i for i in df['batsman']]))
  count = 0
  for j in lst_batsman:
    bt_score = df[(df.batsman==j)]
    score = bt_score['batsman_runs'].sum()
    if(score>30):
      count += 1
  batsman_morethan_30.append(count)
print(batsman_morethan_30)
statistics_for_lists(batsman_morethan_30)<jupyter_output>[5, 3, 5, 4, 5, 2, 3, 3, 4, 1, 3, 1, 3, 5, 4, 4, 3, 2, 3, 3, 2, 2, 1, 3]
Maximum Value Of List:
5
Median of the List:
3.0
Mean of the List:
3.0833333333333335
75% of the Median is:
3
Minimum Value of List:
1<jupyter_text>There are on an average of 3 to 5 players who score above 30 in the match<jupyter_code>#Q3
reqCount=[]
for i in no_of_matches:
  df = ballbyball[ballbyball.match_id==i]
  lst_bowler = list(set([i for i in df['bowler']]))
  count = 0
  for j in lst_bowler:
    bowler_stats = df[df.bowler==j]
    runs_given = bowler_stats['total_runs'].sum()
    balls = bowler_stats.shape[0] # i meant its overs
    if(balls>=24):
      balls = 4
    elif(balls>=18):
      balls = 3
    elif(balls>=12):
      balls = 2
    elif(balls>=6):
      balls=1
    if(runs_given/balls < 9 and balls > 1):
      nof_boundaries = bowler_stats[(bowler_stats.batsman_runs==4) | (bowler_stats.batsman_runs==6)]
      nof_boundaries = nof_boundaries.shape[0]
      sixes = bowler_stats[bowler_stats.batsman_runs==6]
      sixes = sixes.shape[0]
      if(nof_boundaries<6 and sixes<=2):
        count += 1
  reqCount.append(count)
print(reqCount)
statistics_for_lists(reqCount)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15625, 'fraction_numerical': 0.07912234042553191, 'mean_word_length': 4.606211180124224, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '84864', 'license': 'MIT', 'n_tokens_mistral': 2125, 'n_tokens_neox': 1851, 'n_words': 430, 'path': 'archive/mi_vs_dc.ipynb', 'repo_name': 'kh-2000/widhya-datascience-competition', 'size': '4512'}