Project Chadwick Problems
1. Calculate Willie McCovey's Career Batting Average
Batting averages are calculated by dividing the number of hits by the number of at bats a player had. You can download a comma-delimited stats file for Willie McCovey's career from here. You can check your answer Here
2. Find the the top 5 On Base Percentages for the Giants since their move to San Fransisco.
The On Base Percentage or OBP is the percentage of time the player reaches base. It is calculated using the following formula:
OBP = (H + BB + HBP) / (AB + BB + HBP + SF) H = Hits BB = Walks HBP = Hit By Pitch AB = At Bats SF = Sacrifice FliesThe batter should have had at least 200 at bats to be eligible. The results should be printed out with in the following format: players name, yearID, and OBP. A comma delimited file with the batting stats for all SF Giants can be downloaded here.
3. Calculate the Top 10 SLG for the San Fransisco Giants
The Slugging Average (SLG) is a weighted batting average. It gives more weight to the big hits, the higher the SLG means the batter hits the ball hard.
SLG = TB / AB TB = H + 2B + (2 * 3B) + (3 * HR) H = Hits 2B = Doubles 3B = Triples HR = Home RunsThe batter should have had at least 200 at bats to be eligible. The results should be printed out with in the following format: players name, yearID, and SLG. A comma delimited file with the batting stats for all SF Giants can be downloaded here.