Skip to content

Commit 6ec8b0c

Browse files
authored
Update analyze-baseball-stats-with-pandas-and-matplotlib.mdx
1 parent c0e788c commit 6ec8b0c

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

projects/analyze-baseball-stats-with-pandas-and-matplotlib/analyze-baseball-stats-with-pandas-and-matplotlib.mdx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ It's interesting that you can see the abbreviated 2020 season in this graph! The
222222

223223
## Your Favorite Team vs. The League
224224

225-
Another fun visualization that you can create is a comparison of your favorite team's stats to the rest of the league. I grew up in Denver, so my team is the Colorado Rockies, who have been laughably bad for the majority of my life. 😅
225+
Another fun visualization that you can create is a comparison of your favorite team's stats to the rest of the league. I grew up in Denver, so my team is the [Colorado Rockies](https://en.wikipedia.org/wiki/Colorado_Rockies), who have been laughably bad for the majority of my life. 😅
226226

227227
That being said, there is an interesting phenomenon with the Rockies: it is very easy to hit home runs in Denver because of the altitude. As a result, even though the Rockies are generally a fairly weak team, they end up hitting more home runs than their competitors. Let's graph the Rockies' home runs every year against the league average!
228228

@@ -304,7 +304,8 @@ Let's try to identify some of those players! Here's how we'll tackle this proble
304304

305305
Let's begin by calculating OBP. This is the formula that we'll use. It takes into account not just hits, but walks, sacrifice flies, etc.
306306

307-
$OBP = H + BB + HBP / AB + BB + HBP + SF$
307+
$OBP = \frac{H + BB + HBP}{AB + BB + HBP + SF}$
308+
H + BB + HBP / AB + BB + HBP + SF$
308309

309310
Let's add a new column to our Batting table:
310311

@@ -318,7 +319,7 @@ batting['OBP'] = (
318319
(batting['AB'] + batting['BB'] + batting['HBP'] + batting['SF'])
319320
)
320321

321-
# If we got NaN due to no plate appearances, then fill with 0.
322+
# If we got NaN due to no plate appearances, then fill with 0
322323
batting['OBP'] = batting['OBP'].fillna(0)
323324
```
324325

0 commit comments

Comments
 (0)