Skip to content

Commit bc1a604

Browse files
authored
Update analyze-baseball-stats-with-pandas-and-matplotlib.mdx
1 parent 602000f commit bc1a604

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ batting_with_salary.head()
351351

352352
As expected, after performing this join, we're missing salary data about some of the more old-school players.
353353

354+
![salary](https://raw.githubusercontent.com/codedex-io/projects/refs/heads/main/projects/analyze-baseball-stats-with-pandas-and-matplotlib/salary.png)
354355

355356

356357
### Calculating Value
@@ -386,6 +387,8 @@ value_df_sorted [[
386387
]].head()
387388
```
388389

390+
![OBP per dollar 1](https://raw.githubusercontent.com/codedex-io/projects/refs/heads/main/projects/analyze-baseball-stats-with-pandas-and-matplotlib/obp-per-dollar.png)
391+
389392
Our results are a handful of players from the 1980s. This makes sense; salaries were likely much lower in the 80s, but OBP stayed roughly the same. So those players will seemingly be much more "valuable" than modern day players.
390393

391394
If we wanted to see if our calculations were working correctly, we could choose to only look at players from a single year. For example, this gives us the most "valuable" players from 2010.:
@@ -401,8 +404,11 @@ value_df_sorted[value_df_sorted['yearID'] == 2010][[
401404
]].head()
402405
```
403406

407+
![OBP per dollar 2](https://raw.githubusercontent.com/codedex-io/projects/refs/heads/main/projects/analyze-baseball-stats-with-pandas-and-matplotlib/obp-per-dollar2.png)
408+
404409
I went to look up `heywaja01` on [baseball-reference.com](https://baseball-reference.com), and it turns out that this data was from a player named Jason Heyward. In 2010, he was an All Star and got 2nd place in voting for Rookie of the Year! It certainly sounds like a player that was high value. You can also confirm that our calculation of OBP was correct!
405410

411+
![heywaja01](https://raw.githubusercontent.com/codedex-io/projects/refs/heads/main/projects/analyze-baseball-stats-with-pandas-and-matplotlib/heywaja01.png)
406412

407413
## Recap
408414

0 commit comments

Comments
 (0)