In [1]:
%matplotlib inline
import csv
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from retrosheet_controller import RetroSheetDataController
from stats_pitcher import StatsPitcher
In [2]:
# Data controller
client = RetroSheetDataController()
# 分析用のUtilクラス(引数:RETROSHEETを取り扱う用のUtilクラス)
analyzer = StatsPitcher()
In [3]:
# Player IDを取得
player = client.get_player_data_one(2014, 'Jon', 'Lester')
In [4]:
lester_win = analyzer.win_of_month(player['PLAYER_ID'])
In [5]:
lester_win.plot()
plt.title('{first_name} {last_name}(Win)'.format(first_name=player['FIRST_NAME_TX'], last_name=player['LAST_NAME_TX']))
plt.legend(loc='best')
plt.xlabel('Month')
plt.ylabel('Win')
# plt.savefig('jon_lester_win.png') # ファイルに保存
plt.show()
In [ ]: