Write down the algorithm of this code: count = 0 delivery_df_1st_innings = pd.DataFrame() for index, row in
Question:
Write down the algorithm of this code:
count = 0
delivery_df_1st_innings = pd.DataFrame()
for index, row in final_df.iterrows():
if count in [75,108,150,180,268,360,443,458,584,748,982,1052,1111,1226,1345]:
count+=1
continue
count+=1
ball_of_match = []
runs = []
player_of_dismissed = []
teams = []
batting_team = []
winner = []
win_by_runs = []
win_by_wickets = []
match_id = []
city = []
venue = []
for ball in row['innings'][0]['1st innings']['deliveries']:
for key in ball.keys():
match_id.append(count)
batting_team.append(row['innings'][0]['1st innings']['team'])
teams.append(row['info.teams'])
winner.append(row['info.outcome.winner'])
ball_of_match.append(key)
runs.append(ball[key]['runs']['total'])
city.append(row['info.city'])
venue.append(row['info.venue'])
try:
player_of_dismissed.append(ball[key]['wicket']['player_out'])
except:
player_of_dismissed.append('0')
loop_df = pd.DataFrame({
'match_id':match_id,
'teams':teams,
'batting_team':batting_team,
'winner':winner,
'ball':ball_of_match,
'runs':runs,
'player_dismissed':player_of_dismissed,
'city':city,
'venue':venue
})
delivery_df_1st_innings = delivery_df_1st_innings.append(loop_df)
Mathematical Statistics With Applications In R
ISBN: 9780124171138
2nd Edition
Authors: Chris P. Tsokos, K.M. Ramachandran