Created
December 21, 2012 15:04
-
-
Save who-you-me/4353349 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import pandas as pd | |
from teams import teams, teams_old | |
col_use = ["年度", "チーム", "得点", "安打", "二塁打", | |
"三塁打", "本塁打", "盗塁", "盗塁刺", "犠打", | |
"犠飛", "四球", "死球", "三振", "併殺打"] | |
df = pd.read_csv("batting.csv")[col_use] | |
sums = df.groupby(["年度", "チーム"]).sum() | |
model = pd.ols(y=sums["得点"], x=sums.drop("得点", axis=1)) | |
print model | |
df2012 = df[df["年度"] == 2012].groupby("チーム").sum() | |
print df2012.ix["c"]- df2012.mean() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment