Baseball Reference WARΒΆ

Out:

           name_common   age    mlb_ID  ...  OPS_plus   TOB_lg    TB_lg
0        David Aardsma  22.0  430911.0  ...       NaN    0.000    0.000
1        David Aardsma  24.0  430911.0  ... -100.0000    0.694    0.896
2        David Aardsma  25.0  430911.0  ...       NaN    0.000    0.000
3        David Aardsma  26.0  430911.0  ... -100.0000    0.345    0.434
4        David Aardsma  27.0  430911.0  ...       NaN    0.000    0.000
...                ...   ...       ...  ...       ...      ...      ...
109528  Dutch Zwilling  26.0  124791.0  ...  142.1034  199.044  188.238
109529  Dutch Zwilling  27.0  124791.0  ...    7.3437   18.514   18.751
109530       Tony Zych  24.0  543964.0  ...       NaN    0.000    0.000
109531       Tony Zych  25.0  543964.0  ...       NaN    0.000    0.000
109532       Tony Zych  26.0  543964.0  ...       NaN    0.000    0.000

[109533 rows x 49 columns]
             name_common   age    mlb_ID  ...  OPS_plus   TOB_lg    TB_lg
86150          Babe Ruth  28.0  121578.0  ...  239.1529  252.509  211.045
86148          Babe Ruth  26.0  121578.0  ...  238.6033  253.690  229.122
86154          Babe Ruth  32.0  121578.0  ...  225.0409  242.569  220.158
108423  Carl Yastrzemski  27.0  124650.0  ...  193.4291  219.589  219.383
45588     Rogers Hornsby  28.0  116156.0  ...  222.0546  214.622  214.507
9036         Barry Bonds  36.0  111188.0  ...  258.7176  219.120  202.824

[6 rows x 49 columns]
          name_common   age    mlb_ID  ... WAR_rep    ERA_plus    ER_lg
21751  Walter Johnson  25.0  116635.0  ...  3.5162  258.925000  113.927
21750  Walter Johnson  24.0  116635.0  ...  3.7861  242.798246  138.395
15936   Dwight Gooden  20.0  114947.0  ...  2.5333  228.665957  107.473
6654    Steve Carlton  27.0  112008.0  ...  3.0028  182.243421  138.505
7973    Roger Clemens  34.0  112388.0  ...  2.6641  221.573333  132.944
541    Pete Alexander  33.0  110127.0  ...  2.9949  166.094805  127.893

[6 rows x 43 columns]

from pybbda.data import BaseballReferenceData

bbref_data = BaseballReferenceData()

print(bbref_data.war_bat)

print(bbref_data.war_bat.sort_values("WAR", ascending=False).head(6))
print(
    bbref_data.war_pitch.query("year_ID >= 1911")
    .sort_values("WAR", ascending=False)
    .head(6)
)

Total running time of the script: ( 0 minutes 1.003 seconds)

Gallery generated by Sphinx-Gallery