Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
155 views
in Technique[技术] by (71.8m points)

python - Calculating a wickets value in 20 20 cricket

Background to cricket:

  • In 20 20 cricket, each team faces 120 balls or bats until they lose 10 wickets
  • A lost wicket can have two effects on total score
    1. Reduces the total number of balls faced (if 10 wickets fall)
    2. Tends to reduce the speed a team scores

I am trying to calculate

  1. Change in value, in terms of runs lost, of a wicket falling on each ball. For example, the difference in total runs if a wicket is taken on the 10th ball of an innings versus no wicket falling on the tenth ball

  2. Change in value, in terms of runs lost, for each wicket number falling. For example, the change in value when a team looses their third wicket

  3. A combination of the two, the change in value of loosing each wicket on each ball of an innings. For example, the runs difference in runs when the 3rd wicket is lost on ball 50 of an innings

I have a dataframe where each row represents a ball bowled. We have columns representing:

  • The match ID
  • The innings
  • The over and delivery (each 120 ball innings is split into 20 overs)
  • The number of wickets and total runs thus far
  • The number of wickets and total runs at the end of the innings
  • Weather a wicket falls each ball or not
  • The total number of wickets

I am only interested in the change in value in the first innings of the match

Here is code to bring the final score depending on the number of wickets fallen after a specific ball

b1 = df['ball'] ==2.1
b2 = df[b1]
b12 = b2['innings'] ==1

b2[['wickets','t_runs']].groupby('wickets').mean()

Is there a way to extract each ball/wicket combination -> final total run score more efficiently than plugging in different ball values? Could we iterate through each ball or wicket? How about a pivot table

For some situations, there isn't much data. For example, there is nothing on five wickets falling on ball 13 of an innings. How could I predict score when there is a scarcity of samples

question from:https://stackoverflow.com/questions/65942102/calculating-a-wickets-value-in-20-20-cricket

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...