Created
January 6, 2017 09:04
-
-
Save jacobSingh/5705bd73c72fa300362ef2f3b8101a77 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
#REad in the log | |
matches = pd.read_csv('../data/all_but_champ/match_log.csv') | |
#Add a column for match length | |
matches["length"] = matches["player1-score"] + matches["player2-score"] | |
# Get all the records where Trav won | |
travis_winner = matches[matches["winner"] == "Travis Roberts"] | |
# Get all the records where Trav lost | |
travis_loser = matches[matches["loser"] == "Travis Roberts"] | |
#Create an ELO column for all of travis's changes | |
travis_winner["elo"] = matches["winner_elo"] | |
travis_loser["elo"] = matches["loser_elo"] | |
#Put the winnings and losing records together | |
df = pd.concat([travis_winner, travis_loser]) | |
#Sort by date | |
df.sort_values("match-completed-at", inplace=True) | |
#generate the rolling mean with a 20 match window | |
x = pd.rolling_mean(df['elo'], window=20) | |
#plot it! | |
plt.plot(list(x)) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment