-
-
Save mieitza/18342f7431d12ea69cfe8bf4d5005e62 to your computer and use it in GitHub Desktop.
This file contains hidden or 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