Created
January 29, 2020 02:27
-
-
Save mrakitin/d0bb4b8e60f7e086cc5c429231f096dc 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
import datetime | |
import numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
d = pd.read_html('http://www.espn.com/nfl/superbowl/history/winners', header=1) | |
scores = [] | |
for s in d[0]['RESULT']: | |
parts = s.split(',') | |
scores.append([int(parts[0].split(' ')[-1]), int(parts[1].split(' ')[-1])]) | |
scores = np.array(scores) | |
# sum_scores = scores.sum(axis=1) | |
dates = [] | |
for s in d[0]['DATE']: | |
dates.append(datetime.datetime.strptime(s, '%b. %d, %Y')) | |
df = pd.DataFrame(data=[[d, w, l] for d, (w, l) in zip(dates, scores)], columns=['date', 'winner', 'looser']) | |
df['total'] = df['winner'] + df['looser'] | |
df.plot(x='date', grid=True) |
Author
mrakitin
commented
Jan 29, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment