{"id":150,"date":"2019-11-05T12:40:05","date_gmt":"2019-11-05T12:40:05","guid":{"rendered":"http:\/\/www.stattosoftware.com\/consulting\/?p=150"},"modified":"2019-11-05T12:57:33","modified_gmt":"2019-11-05T12:57:33","slug":"mlb-the-odds-of-a-perfect-game","status":"publish","type":"post","link":"https:\/\/www.stattosoftware.com\/consulting\/2019\/11\/05\/mlb-the-odds-of-a-perfect-game\/","title":{"rendered":"MLB: The odds of a perfect game"},"content":{"rendered":"<p>As I sat with my friend in the second deck of Dodger Stadium on September 4, 2017, we began to contemplate the impossible.<\/p>\n<p>Heading into the bottom of the sixth inning, Robbie Ray had retired the first 15 batters he faced without allowing a baserunner. The Diamondbacks were up 2-0, J.D. Martinez having hit a two-run homer in the 4th.<\/p>\n<p>Leading off the bottom of the 6th, Logan Forsythe would put a temporary end to our dream of seeing a historical baseball evening with a hard-hit single to center. Ray\u2019s perfect game had suffered an early defeat.<\/p>\n<p>Unlike most baseball nights, the dream of seeing history would later be resurrected by Kristopher Negron\u2019s (remember him?) ninth-inning double to left, virtually guaranteeing Martinez would get his chance to hit his fourth home run of the night.<\/p>\n<p>Unlike the perfect game, the four home run night builds: it is not until the third home run you consider yourself a potential witness to history, with a perfect game conspicuous by the three consecutive zeros on the scoreboard from start to finish.<\/p>\n<p>With the scoreboard still showing those zeros in the fifth, I began to wonder: how rare of an event is it to retire the first 15 batters of the game? And, certainly, while the odds of a perfect game are easily found, certainly if you\u2019ve gone slightly more than halfway through a game without allowing a batter, your odds of finishing the night without a baserunner must be increased from the norm, right?<\/p>\n<p>I couldn\u2019t find this information anywhere, in spite of getting to Google Page #17 on a fairly specific search. As such, I decided to write a little computer program (a Python script, for you fellow nerds) which parsed retrosheet.org play-by-play data to figure out how rare the Robbie Ray 15-straight-to-start-the-game outing was, and to determine the odds of pitching a perfect game by the number of outs from the top of the first.<\/p>\n<p>I took all the play-by-play files from retrosheet.org from 1930 \u2013 not all the games are complete, and there may be small errors here and there which I didn\u2019t account for, and I didn\u2019t check for pitching changes \u2013 and ran them through a parser. The parser determined at what out the first batter reached base. If the walk happened with 2 outs in the first, I marked it as a \u201c2\u201d.<\/p>\n<p>It turns out Robbie Ray\u2019s 15 straight was a decently special event, occurring only 939 times in the 304,933 team play-by-plays analyzed (it\u2019s an odd number since several bad play-by-play files were removed.) If it were a batting average, seeing 15 in a row mowed down is akin to seeing a player with a .003 batting average getting a hit. It happens once about every 162.5 games, so a starter for each team should do it once a year.<\/p>\n<p>However, to demonstrate the difficulty of pitching a perfect game, Ray only had a .019 chance of making history at that point. He\u2019s already pitched a game in the 99.7% percentile in terms of keeping runners off base from the start of the game, and he\u2019s <em>still<\/em> only got a very small chance of making history.<\/p>\n<p>Statistically, a pitcher has about a 28% chance of getting through the first inning without allowing a baserunner, but he only increases his odds of pitching a perfect game to .0002.<\/p>\n<p>The probabilities finally start looking better for a pitcher around the seventh inning. This makes sense, as more perfect games are lost with 9 outs gone than 8, and even 18 outs gone than 17, because of the pitcher\u2019s slot in the National League (8 and 17 representing two outs in the bottom of the 3rd and 6th, respectively.) The pitcher will have gone through what should be the best part of the lineup three times and is on the home stretch.<\/p>\n<p>The first time a pitcher has a &gt;10% chance of a perfect game is with 21 outs gone, or through seven innings. From there, the odds begin increasing dramatically: 20.7% after 22, 29.5% after 23, 41.9% after 24, 51.4% after 25, and 62.1% after 26 outs. That\u2019s right: 11 of the 29 times a pitcher got to 26 outs, batter number 27 reached base (including, remember, Yusmeiro Petit.)<\/p>\n<p>Though the sample size is very, very small to the point where trying to divine meaning doesn&#8217;t make much sense, it\u2019s still interesting the 29 batters representing the final out in a perfect game have a reached base a higher percentage of the time (.379) than the 304,933 leadoff batters (.345). Even more interesting, the biggest jump in historic probability occurs between outs 23 and 24. Batters have only broken up a perfect game 14 times in the bottom of the 9th with zero or one out, compared to 11 times with two outs. In fact, the rarest situation is the perfect game broken up after one out in the 9th \u2013 the 8th batter has only made it on base 6 times in 35 possibilities, for a .171 OBP (well, an OBP which includes errors.)<\/p>\n<p>If you see a pitcher retire the first three batters, that\u2019s between a 1-in-3 and 1-in-4 occurrence. If he makes it through two innings, that\u2019s approximately a 1-in-11. Retiring nine straight to start the game happens roughly once every 31 games \u2013 by that point, the pitcher has done better than 97.9% of all pitchers since 1930, in games without corrupted play-by-play data.<\/p>\n<p>Another interesting statistic: the on base with error percentages are highest for outs 27 (.379), 2 (.355), 1 (.345), 20 (.349), and 11 (.339). Generally, with the exception of the number three hitter, the chance a batter will reach base in a given situation decreases as the game gets on, which is in line with what we\u2019d expect with a pitcher capable of retiring 18 straight \u2013 until, of course, that final out.<\/p>\n<p>Oh, and the Dennis Martinez 1991 perfecto is the only time in the play-by-play I looked at where both pitchers took perfectos into the sixth inning in any game \u2013 fortunately for Dennis, Mike Morgan gave up a no-out sixth inning hit to Tucson, Arizona native Ron Hassey, the only catcher in history to catch more than one perfect game.<\/p>\n<p>So, your conclusion: enjoy the games where the pitcher gets into the fourth or fifth inning without allowing any baserunners. The fun\u2019s likely to end soon, but you\u2019ve still witnessed a fairly rare event. If a pitcher is perfect through seven, you\u2019re unlikely to see a perfect game, but you\u2019ve now got a 1-in-7 chance of witnessing history. And be nervous with two outs in the ninth, since the only person in the stadium who isn\u2019t nervous is probably Eric Chavez.<\/p>\n<p>I have included the table and the Python script below. (Sorry about the headers. An hour of CSS design didn&#8217;t do much.)<\/p>\n<table width=\"636\" cellspacing=\"0\" cellpadding=\"2\" style=\"border-width:1px; border-style:solid black;\">\n<colgroup>\n<col width=\"38\" \/>\n<col width=\"56\" \/>\n<col width=\"86\" \/>\n<col width=\"50\" \/>\n<col width=\"62\" \/>\n<col width=\"68\" \/>\n<col width=\"44\" \/>\n<col width=\"56\" \/>\n<col width=\"86\" \/>\n<col width=\"49\" \/> <\/colgroup>\n<tbody>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" style=\"text-align: center;\" align=\"left\">Outs<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" style=\"text-align: center;\" align=\"left\">Times ended<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" style=\"text-align: center;\" align=\"left\">Total occurrences<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" style=\"text-align: center;\" align=\"left\">Percent chance of perfect game<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" style=\"text-align: center;\" align=\"left\">Percent chance of retiring X straight to start the game<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" style=\"text-align: center;\" align=\"left\">Individual odds of having the game be broken up after this out<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" style=\"text-align: center;\" align=\"left\">Percentile<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" style=\"text-align: center;\" align=\"left\">Odds change between outs<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" style=\"text-align: center;\" align=\"left\">OBP (with error) % by out<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" style=\"text-align: center;\" align=\"left\">1 in X games*<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">0<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">105159<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">304933<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">1.000<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.345<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">.345<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.345<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">1<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">1<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">66685<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">199774<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.655<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.219<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">.564<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.334<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">2<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">2<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">47259<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">133089<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.436<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.155<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">.719<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.355<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">2<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">3<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">29771<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">85830<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.281<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.098<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">.816<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.347<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">4<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">4<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">18385<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">56059<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.184<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.060<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">.876<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.328<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">5<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">5<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">12020<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">37674<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.124<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.039<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">.916<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.319<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">8<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">6<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">7902<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">25654<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.001<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.084<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.026<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">.942<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.308<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">12<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">7<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">5202<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">17752<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.001<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.058<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.017<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">.959<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.293<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">17<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">8<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">2760<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">12550<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.001<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.041<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.009<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">.968<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.220<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">24<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">9<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">3246<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">9790<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.002<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.032<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.011<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">.979<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.001<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.332<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">31<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">10<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">2185<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">6544<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.003<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.021<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.007<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">.986<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.001<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.334<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">47<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">11<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">1476<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">4359<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.004<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.014<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.005<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">.991<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.002<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.339<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">70<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">12<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">923<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">2883<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.006<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.009<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.003<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">.994<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.003<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.320<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">106<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">13<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">604<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">1960<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.009<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.006<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.002<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">.996<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.004<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.308<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">156<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">14<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">417<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">1356<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.013<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.004<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.001<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">.997<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.006<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.308<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">225<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">15<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">261<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">939<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.019<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.003<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.001<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">.998<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.007<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.278<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">325<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">16<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">190<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">678<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.027<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.002<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.001<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">.998<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.010<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.280<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">450<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">17<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">107<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">488<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.037<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.002<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">.999<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.010<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.219<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">625<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">18<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">116<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">381<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.047<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.001<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">.999<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.021<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.304<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">800<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">19<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">73<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">265<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.068<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.001<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">.999<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.026<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.275<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">1151<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">20<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">67<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">192<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.094<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.001<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">1.000<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.050<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.349<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">1588<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">21<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">38<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">125<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.144<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">1.000<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.063<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.304<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">2439<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">22<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">26<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">87<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.207<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">1.000<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.088<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.299<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">3505<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">23<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">18<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">61<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.295<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">1.000<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.124<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.295<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">4999<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">24<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">8<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">43<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.419<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">1.000<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.096<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.186<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">7091<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">25<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">6<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">35<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.514<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">1.000<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.106<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.171<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">8712<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">26<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">11<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">29<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">.621<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">1.000<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">.379<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">.379<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">10515<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"bottom\">\n<td width=\"38\" height=\"13\">\n<p class=\"western\" align=\"right\">27<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">18<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">18<\/p>\n<\/td>\n<td width=\"50\">\n<p class=\"western\" align=\"right\">1.000<\/p>\n<\/td>\n<td width=\"62\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"68\">\n<p class=\"western\" align=\"right\">.000<\/p>\n<\/td>\n<td width=\"44\">\n<p class=\"western\" align=\"right\">1.000<\/p>\n<\/td>\n<td width=\"56\">\n<p class=\"western\" align=\"right\">-1.000<\/p>\n<\/td>\n<td width=\"86\">\n<p class=\"western\" align=\"right\">1.000<\/p>\n<\/td>\n<td width=\"49\">\n<p class=\"western\" align=\"right\">16941<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"western\">*divide by two to get the actual number, since we \u201ccount\u201d each game twice: once for each team.<\/p>\n<p>And the python script:<\/p>\n<div style=\"background-color: #ccc; border: 1px solid black; font-family: Courier New,Courier,monospace, monospace; padding: 2px; margin: 2px;\">\n<code><br \/>\n*divide by two to get the actual number, since we \u201ccount\u201d each game twice: once for each team.<br \/>\n#\u00a9 2018 John Holden<br \/>\n#You are free to use and distribute this script as long as you do not charge and credit is given to the author<br \/>\n#Script to determine play-by-play<br \/>\nimport csv<br \/>\nimport os<\/p>\n<p>#printMe function -<br \/>\n#instead of printing all files to the console, just print a couple games to check to see it\u2019s working properly<br \/>\n#otherwise it gets super unwieldy super quickly<br \/>\n#also check to see what games don\u2019t catch and give you >27 outs<br \/>\ndef printMe(printString):<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;if (activegame < 17 and activegame > 16) or firstout1 > 27 or firstout2 > 27:<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(printString)<\/p>\n<p>#define which variables we will be using<br \/>\nactivegame = 0&nbsp;&nbsp;&nbsp;&nbsp;<br \/>\nonbase1 = 0&nbsp;&nbsp;&nbsp;&nbsp;#flag for the away team to see if anyone has been on base<br \/>\nonbase2 = 0&nbsp;&nbsp;&nbsp;&nbsp;#flag for the home team to see if anyone has been on base<br \/>\nfirstout1 = 0&nbsp;&nbsp;&nbsp;&nbsp;#variable to store how many outs there were when person reached base<br \/>\nfirstout2 = 0<br \/>\nider = ''&nbsp;&nbsp;&nbsp;&nbsp;#for display purposes \u2013 gets the ID of the game<br \/>\nouts = {}&nbsp;&nbsp;&nbsp;&nbsp;# dictionary to track the number of times a perfecto was broken up at a specific number of outs<\/p>\n<p>for csvFilename in os.listdir('PerfectGame'):<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;if csvFilename.endswith('.EVN') or csvFilename.endswith('.EVA'):<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;with open('PerfectGame\/' + csvFilename, 'rb') as csvfile:<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pbp = csv.reader(csvfile, delimiter=',', quotechar='\"')<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for row in pbp:<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if row[0] == \"id\":<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printMe(\"new game\")<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if activegame > 0:<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;outs[firstout1] = outs.get(firstout1, 0) + 1<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;outs[firstout2] = outs.get(firstout2, 0) + 1<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if firstout1 > 25 or firstout2 > 25:<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#print all the games that went into the ninth inning to make sure this is working properly<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(ider + \" \" + str(firstout1) + \" \" + str(firstout2))<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#we have a new game going so reset all the variables<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;firstout1 = 0<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;firstout2 = 0<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;onbase1 = 0<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;onbase2 = 0<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;activegame = activegame + 1<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ider = row[1]<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if row[0] == \"play\":<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pbpres = row[6]<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printMe(row)<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#checks to see if any of the game data from Retrosheet matches getting on base<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if onbase1 == 0 and row[2] == '0':<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if pbpres[:1] == \"H\" or pbpres[:1] == \"T\" or pbpres[:1] == \"D\" or pbpres[:1] == \"S\" or pbpres[:1] == \"W\" or pbpres[:1] == \"E\":<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;onbase1 = 1<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printMe(\"game1 killed\"  + str(firstout1))<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elif pbpres[:2] != \"NP\":<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;firstout1 = firstout1 + 1<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#checks for home team \u2013 this could have been looped<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if onbase2 == 0 and row[2] == '1':<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if pbpres[:1] == \"H\" or pbpres[:1] == \"T\" or pbpres[:1] == \"D\" or pbpres[:1] == \"S\" or pbpres[:1] == \"W\" or pbpres[:1] == \"E\":<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;onbase2 = 1<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printMe(\"game2 killed \" + str(firstout2))<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elif pbpres[:2] != \"NP\":<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;firstout2 = firstout2 + 1<br \/>\nprint(outs)<br \/>\n<\/code>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>As I sat with my friend in the second deck of Dodger Stadium on September 4, 2017, we began to contemplate the impossible. Heading into the bottom of the sixth inning, Robbie Ray had retired the first 15 batters he faced without allowing a baserunner. The Diamondbacks were up 2-0, J.D. Martinez having hit a &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.stattosoftware.com\/consulting\/2019\/11\/05\/mlb-the-odds-of-a-perfect-game\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;MLB: The odds of a perfect game&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[8,7],"tags":[],"class_list":["post-150","post","type-post","status-publish","format-standard","hentry","category-baseball","category-sports-analytics","entry"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pbkw4b-2q","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.stattosoftware.com\/consulting\/wp-json\/wp\/v2\/posts\/150","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.stattosoftware.com\/consulting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.stattosoftware.com\/consulting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.stattosoftware.com\/consulting\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.stattosoftware.com\/consulting\/wp-json\/wp\/v2\/comments?post=150"}],"version-history":[{"count":10,"href":"https:\/\/www.stattosoftware.com\/consulting\/wp-json\/wp\/v2\/posts\/150\/revisions"}],"predecessor-version":[{"id":160,"href":"https:\/\/www.stattosoftware.com\/consulting\/wp-json\/wp\/v2\/posts\/150\/revisions\/160"}],"wp:attachment":[{"href":"https:\/\/www.stattosoftware.com\/consulting\/wp-json\/wp\/v2\/media?parent=150"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.stattosoftware.com\/consulting\/wp-json\/wp\/v2\/categories?post=150"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.stattosoftware.com\/consulting\/wp-json\/wp\/v2\/tags?post=150"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}