<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Comparing the Dominance of Three of the Best All-Time Teams
A quick analysis and visuzliation of three of the best baseball seasons that have ever happened
Step1:  Summary Statistics
Let's start by looking at some summary stats on each team's season. The '01 Mainers had the best hot streak of all, winning 15 straight at one point. The '27 Yankees, however, had the highest scoring offense with an impressive 6.3 runs per game.
Step2:  Next let's take a look at their records and runs.
Here the Yankees and Mariners are similar, while the Big Red Machine lags behind. Point Mariners and Yankees.
Step3:  Last let's take a look at score differential
Who had the largest win margins? The plot below shows cumulative run differential throughout the season. The Yankees are the clear winners of this one, which is saying a lot considering they are being compared against two of the best teams of all time! Point Murderers Row.
<ASSISTANT_TASK:>
Python Code:
from pybaseball import schedule_and_record
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
yankees = schedule_and_record(1927, 'NYY')
reds = schedule_and_record(1976, 'CIN')
mariners = schedule_and_record(2001, 'SEA')
Explanation: Comparing the Dominance of Three of the Best All-Time Teams
A quick analysis and visuzliation of three of the best baseball seasons that have ever happened: the 1976 Cincinnati Reds, 2001 Seattle Mariners, and the 1927 "Murderers Row" New York Yankees.
End of explanation
mariners.describe()
reds.describe()
yankees.describe()
Explanation: Summary Statistics
Let's start by looking at some summary stats on each team's season. The '01 Mainers had the best hot streak of all, winning 15 straight at one point. The '27 Yankees, however, had the highest scoring offense with an impressive 6.3 runs per game.
End of explanation
# create a numeric indicator of a win and take cumulative sum of wins-to-date at each point in the season
mariners['win-count'] = np.where(mariners['W/L']=='W', 1, 0).cumsum()
yankees['win-count'] = np.where(yankees['W/L']=='W', 1, 0).cumsum()
reds['win-count'] = np.where(reds['W/L']=='W', 1, 0).cumsum()
plt.plot(mariners['win-count'],label=" '01 Mariners")
plt.plot(yankees['win-count'],label=" '27 Yankees")
plt.plot(reds['win-count'],label=" '76 Reds")
plt.legend(loc=4)
plt.xlabel('Games into Season')
plt.ylabel('Win Count')
plt.title('Record Throughout Season');
Explanation: Next let's take a look at their records and runs.
Here the Yankees and Mariners are similar, while the Big Red Machine lags behind. Point Mariners and Yankees.
End of explanation
mariners['scorediff'] = (mariners['R'] - mariners['RA']).cumsum()
yankees['scorediff'] = (yankees['R'] - yankees['RA']).cumsum()
reds['scorediff'] = (reds['R'] - reds['RA']).cumsum()
plt.plot(mariners['scorediff'],label=" '01 Mariners")
plt.plot(yankees['scorediff'],label=" '27 Yankees")
plt.plot(reds['scorediff'],label=" '76 Reds")
plt.legend(loc=4)
plt.xlabel('Games into Season')
plt.ylabel('Runs Scored - Runs Against')
plt.title('Cumulative Run Differential');
Explanation: Last let's take a look at score differential
Who had the largest win margins? The plot below shows cumulative run differential throughout the season. The Yankees are the clear winners of this one, which is saying a lot considering they are being compared against two of the best teams of all time! Point Murderers Row.
End of explanation
<END_TASK>