text_plain_output_1.png image_output_1.png
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

pitching = pd.read_csv('/kaggle/input/baseball-databank/Pitching.csv')

pitching = pitching[(pitching['yearID'] >= 1990) & (pitching['GS'] >= 26) & (pitching['G'] == pitching['GS'])].iloc[:, :20]
pitching = pitching.drop(['stint', 'W', 'L', 'CG', 'SHO', 'SV'], axis=1)

pitching = pitching.set_index('playerID')

pitching.shape[0]

pitching['IP'] = (pitching['IPouts'] / 3).round(2)
del pitching['IPouts']

pitching['BB9'] = (pitching['BB'] * 9 / pitching['IP']).round(2)

pitching['SOtoBB'] = (pitching['SO'] / pitching['BB']).round(2)

pitching.SO.idxmax()