├── .gitignore
├── requirements.txt
├── espnfantasyfootball
├── __init__.py
└── espnfantasyfootball.py
├── setup.py
├── .devcontainer
└── devcontainer.json
├── README.md
└── example_notebook.ipynb
/.gitignore:
--------------------------------------------------------------------------------
1 | /config.py
2 |
3 | espnsecrets.py
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | pandas
2 | matplotlib
3 | seaborn
4 | requests
--------------------------------------------------------------------------------
/espnfantasyfootball/__init__.py:
--------------------------------------------------------------------------------
1 | from espnfantasyfootball.espnfantasyfootball import FantasyLeague
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | from setuptools import setup
2 |
3 | setup(
4 | name='espnfantasyfootball',
5 | version='0.1.1',
6 | description='A Python package to interact with ESPN Fantasy Football data',
7 | url='https://github.com/tbryan2/espnfantasyfootball',
8 | author='Tim Bryan',
9 | license='MIT',
10 | packages=['espnfantasyfootball'],
11 | install_requires=['requests', 'pandas']
12 | )
--------------------------------------------------------------------------------
/.devcontainer/devcontainer.json:
--------------------------------------------------------------------------------
1 | {
2 | "image": "mcr.microsoft.com/devcontainers/python:0-3.9",
3 | "hostRequirements": {
4 | "cpus": 4
5 | },
6 | "waitFor": "onCreateCommand",
7 | "updateContentCommand": "python3 -m pip install -r requirements.txt",
8 | "postCreateCommand": "",
9 | "customizations": {
10 | "codespaces": {
11 | "openFiles": []
12 | },
13 | "vscode": {
14 | "extensions": [
15 | "ms-toolsai.jupyter",
16 | "ms-python.python"
17 | ]
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # espnfantasyfootball
2 | `pip install espnfantasyfootball`
3 |
4 | ### Security Requirements
5 | You will need to find your _league_id_ as well as the _swid_ and _espn_s2_ cookie parameters for your league. The league_id is found in the URL of your fantasy league:
6 |
7 |
8 |
9 |
10 |
11 | To find the swid and espn_s2 cookie parameters, go to you any page on your fantasy league's website. Right click on the page and hit __Inspect Element__. Locate the _Storage_ tab in your browser's developer tools and find _Cookies_. Locate these two cookie parameters and copy them into a secrets.py file to be imported later.
12 |
13 | ## FantasyLeague
14 | Create a FantasyLeague object by importing the package and instantiating the class:
15 | ```
16 | import espnfantasyfootball as espn
17 | import pandas as pd
18 | import secrets
19 |
20 | league = espn.FantasyLeague(league_id=730129, year=2022,
21 | swid=secrets.swid, espn_s2=secrets.espn_s2)
22 | ```
23 |
24 | ## Pulling Data
25 | Now that we have the league object created, we can pull data. You can pull player data as well as league matchup data:
26 |
27 |
28 | `player_data = league.get_league_data()`
29 |
30 | `print(player_data)`
31 | ```python
32 | | Week | PlayerName | PlayerScoreActual | PlayerScoreProjected | PlayerFantasyTeam | PlayerRosterSlot | TeamName | FullName |
33 | |------|----------------------|------------------|---------------------|---------------------|------------------|--------------------------|-------------|
34 | | 0 | Derrick Henry | 16.1 | 17.382072 | 1 | RB | Pfizer Save us | Toker Blaze |
35 | | 1 | Aaron Jones | 17.6 | 15.289672 | 1 | RB | Pfizer Save us | Toker Blaze |
36 | | 2 | George Kittle | 9.3 | 15.967135 | 1 | TE | Pfizer Save us | Toker Blaze |
37 | | 3 | Robert Woods | 17.9 | 14.470935 | 1 | WR | Pfizer Save us | Toker Blaze |
38 | | 4 | JuJu Smith-Schuster | 24.9 | 14.596111 | 1 | WR | Pfizer Save us | Toker Blaze |
39 | | ... | ... | ... | ... | ... | ... | ... | ... |
40 | | 157 | Preston Williams | 0.0 | 0.000000 | 14 | Bench | Edinburgh Chubby chasers | John Meier |
41 | | 158 | Zane Gonzalez | 0.0 | 0.000000 | 14 | K | Edinburgh Chubby chasers | John Meier |
42 | | 159 | Cowboys D/ST | 12.1 | 12.143736 | 14 | Bench | Edinburgh Chubby chasers | John Meier |
43 | | 160 | Myles Gaskin | 17.7 | 16.453915 | 14 | Bench | Edinburgh Chubby chasers | John Meier |
44 | | 161 | J.D. McKissic | 8.0 | 13.152776 | 14 | RB | Edinburgh Chubby chasers | John Meier |
45 | ```
46 | `matchup_data = league.get_matchup_data()`
47 |
48 | `print(matchup_data)`
49 | ```python
50 | | Week | Name1 | Score1 | Name2 | Score2 | Type |
51 | |------|--------------------------|--------|-----------------------|--------|---------|
52 | | 0 | Edinburgh | 93.49 | The Masked Singers | 135.95 | Regular |
53 | | 1 | Happy Hanukkah | 146.31 | The Bros | 130.68 | Regular |
54 | | 2 | Pittsburgh Steelers | 145.97 | Hooked on a Thielen | 181.15 | Regular |
55 | | 3 | Gonq Unicorns | 153.85 | 3rd Place Pays Out | 89.58 | Regular |
56 | | 4 | Tame Klonger | 111.03 | Pfizer Save us | 149.84 | Regular |
57 | | ... | ... | ... | ... | ... | ... |
58 | | 1287 | Gonq Unicorns | 128.72 | The Masked Singers | 119.15 | Playoff |
59 | | 1288 | Hooked on a Thielen | 114.22 | Pfizer Save us | 168.56 | Playoff |
60 | | 1289 | Pittsburgh Steelers | 160.07 | Tame Klonger | 143.83 | Playoff |
61 | | 1290 | 3rd Place Pays Out | 70.81 | Edinburgh | 123.26 | Playoff |
62 | | 1291 | The Bros | 84.00 | Happy Hanukkah | 155.73 | Playoff |
63 | ```
64 |
65 | By default, the functions will pull the full year of data but an optional `week=` parameter can be supplied to pull specific weeks.
66 |
--------------------------------------------------------------------------------
/espnfantasyfootball/espnfantasyfootball.py:
--------------------------------------------------------------------------------
1 | import requests
2 | import pandas as pd
3 |
4 |
5 | class FantasyLeague:
6 | '''
7 | ESPN Fantasy Football League class for pulling data from the ESPN API
8 | '''
9 | BASE_URL = "https://fantasy.espn.com/apis/v3/games/ffl/seasons/{year}/segments/0/leagues/{league_id}"
10 | POSITION_MAPPING = {
11 | 0: 'QB',
12 | 4: 'WR',
13 | 2: 'RB',
14 | 23: 'FLEX',
15 | 6: 'TE',
16 | 16: 'D/ST',
17 | 17: 'K',
18 | 20: 'Bench',
19 | 21: 'IR',
20 | '': 'NA'
21 | }
22 |
23 | def __init__(self, league_id, year, espn_s2, swid):
24 | self.league_id = league_id
25 | self.year = year
26 | self.espn_s2 = espn_s2
27 | self.swid = swid
28 | self.base_url = f"https://fantasy.espn.com/apis/v3/games/ffl/seasons/{self.year}/segments/0/leagues/{self.league_id}"
29 | self.cookies = {
30 | "swid": self.swid,
31 | "espn_s2": self.espn_s2
32 | }
33 | self.matchup_df = None
34 | self.team_df = None
35 |
36 | def make_request(self, url, params, view):
37 | '''
38 | Initiate a request to the ESPN API
39 | '''
40 | params['view'] = view
41 | return requests.get\
42 | (url, params=params, cookies={"SWID": self.swid, "espn_s2": self.espn_s2}, timeout=30).json()
43 |
44 | def load_league(self, week):
45 | '''
46 | Load the league JSON from the ESPN API
47 | '''
48 | url = self.BASE_URL.format(year=self.year, league_id=self.league_id)
49 | return self.make_request(url + '?view=mMatchup&view=mMatchupScore',
50 | params={'scoringPeriodId': week, 'matchupPeriodId': week}, view='mMatchup')
51 |
52 | def load_player_data(self, league_json, week):
53 | '''
54 | Load the player data from the league JSON
55 | '''
56 | player_name = []
57 | player_score_act = []
58 | player_score_proj = []
59 | player_roster_slot = []
60 | player_fantasy_team = []
61 | weeks = []
62 |
63 |
64 | # Loop through each team
65 | for team in range(0, len(league_json['teams'])):
66 |
67 | # Loop through each roster slot in each team
68 | for slot in range(0, len(league_json['teams'][team]['roster']['entries'])):
69 | # Append the week number to a list for each entry for each team
70 | weeks.append(week)
71 | # Append player name, player fantasy team, and player ro
72 | player_name.append(league_json['teams'][team]['roster']
73 | ['entries'][slot]['playerPoolEntry']['player']['fullName'])
74 | player_fantasy_team.append(league_json['teams'][team]['id'])
75 | player_roster_slot.append(
76 | league_json['teams'][team]['roster']['entries'][slot]['lineupSlotId'])
77 |
78 | # Initialize the variables before using them
79 | act = 0
80 | proj = 0
81 |
82 | # Loop through each statistic set for each roster slot for each team
83 | # to get projected and actual scores
84 | for stat in league_json['teams'][team]['roster']['entries'][slot]['playerPoolEntry']['player']['stats']:
85 | if stat['scoringPeriodId'] != week:
86 | continue
87 | if stat['statSourceId'] == 0:
88 | act = stat['appliedTotal']
89 | elif stat['statSourceId'] == 1:
90 | proj = stat['appliedTotal']
91 | else:
92 | print('Error')
93 |
94 | player_score_act.append(act)
95 | player_score_proj.append(proj)
96 |
97 | # Put the lists into a dictionary
98 | player_dict = {
99 | 'Week': weeks,
100 | 'PlayerName': player_name,
101 | 'PlayerScoreActual': player_score_act,
102 | 'PlayerScoreProjected': player_score_proj,
103 | 'PlayerRosterSlotId': player_roster_slot,
104 | 'PlayerFantasyTeam': player_fantasy_team
105 | }
106 |
107 | # Transform the dictionary into a DataFrame
108 | df = pd.DataFrame.from_dict(player_dict)
109 |
110 | # Initialize empty column for PlayerRosterSlot
111 | df['PlayerRosterSlot'] = ""
112 |
113 | # Ignore chained assignment warnings
114 | pd.options.mode.chained_assignment = None
115 |
116 | # Replace the PlayerRosterSlot integers with position indicators
117 | df['PlayerRosterSlot'] = df['PlayerRosterSlotId'].apply(
118 | lambda x: self.POSITION_MAPPING.get(x, 'NA'))
119 |
120 | df.drop(columns=['PlayerRosterSlotId'], inplace=True)
121 | self.df = df
122 |
123 | def load_team_names(self, week):
124 | '''
125 | Load the team names from the league JSON
126 | '''
127 | # Define the URL with our parameters
128 | url = self.BASE_URL.format(year=self.year, league_id=self.league_id)
129 |
130 | team_json = self.make_request(url,
131 | params={"leagueId": self.league_id,
132 | "seasonId": self.year,
133 | "matchupPeriodId": week},
134 | view="mTeam")
135 |
136 | # Initialize empty list for team names and team ids
137 | team_id = []
138 | team_primary_owner = []
139 | team_location = []
140 | team_nickname = []
141 | owner_first_name = []
142 | owner_last_name = []
143 | team_cookie = []
144 |
145 | # Loop through each team in the JSON
146 | for team in range(0, len(team_json['teams'])):
147 | # Append the team id and team name to the list
148 | team_id.append(team_json['teams'][team]['id'])
149 | team_primary_owner.append(team_json['teams'][team]['primaryOwner'])
150 | team_location.append(team_json['teams'][team]['location'])
151 | team_nickname.append(team_json['teams'][team]['nickname'])
152 | owner_first_name.append(team_json['members'][team]['firstName'])
153 | owner_last_name.append(team_json['members'][team]['lastName'])
154 | team_cookie.append(team_json['members'][team]['id'])
155 |
156 | # Create team DataFrame
157 | team_df = pd.DataFrame({
158 | 'PlayerFantasyTeam': team_id,
159 | 'TeamPrimaryOwner': team_primary_owner,
160 | 'Location': team_location,
161 | 'Nickname': team_nickname,
162 | })
163 |
164 | # Create owner DataFrame
165 | owner_df = pd.DataFrame({
166 | 'OwnerFirstName': owner_first_name,
167 | 'OwnerLastName': owner_last_name,
168 | 'TeamPrimaryOwner': team_cookie
169 | })
170 |
171 | # Merge the team and owner DataFrames on the TeamPrimaryOwner column
172 | team_df = pd.merge(team_df, owner_df, on='TeamPrimaryOwner', how='left')
173 |
174 | # Filter team_df to only include PlayerFantasyTeam, Location, Nickname, OwnerFirstName, and OwnerLastName
175 | team_df = team_df[['PlayerFantasyTeam', 'Location',
176 | 'Nickname', 'OwnerFirstName', 'OwnerLastName']]
177 |
178 | # Concatenate the two name columns
179 | team_df['TeamName'] = team_df['Location'] + ' ' + team_df['Nickname']
180 |
181 | # Create a column for full name
182 | team_df['FullName'] = team_df['OwnerFirstName'] + \
183 | ' ' + team_df['OwnerLastName']
184 |
185 | # Drop all columns except id and Name
186 | team_df = team_df.filter(['PlayerFantasyTeam', 'TeamName', 'FullName'])
187 |
188 | self.df = self.df.merge(team_df, on=['PlayerFantasyTeam'], how='left')
189 | self.df = self.df.rename(columns={'Name': 'PlayerFantasyTeamName'})
190 |
191 | def get_league_data(self, week=None):
192 | '''
193 | Create the league DataFrame
194 | '''
195 | if week is None: # If no specific week is provided, load data for all weeks.
196 | weeks = list(range(1, 18)) # Assuming 17 weeks in a season.
197 | else:
198 | weeks = [week]
199 |
200 | # Instead of appending to self.df directly, we're going to store each week's DataFrame in a list.
201 | dataframes = []
202 |
203 | for week in weeks:
204 | league_json = self.load_league(week)
205 | self.load_player_data(league_json, week)
206 | self.load_team_names(week)
207 |
208 | # After loading the data for the week, add a copy of the DataFrame to the list.
209 | dataframes.append(self.df.copy())
210 |
211 | # Concatenate all weekly dataframes into one.
212 | self.df = pd.concat(dataframes)
213 |
214 | return self.df
215 |
216 | def get_matchup_data(self, week=None):
217 | if week is None:
218 | weeks = list(range(1, 18)) # Weeks 1 through 17
219 | else:
220 | weeks = [week]
221 |
222 | all_matchup_data = []
223 |
224 | for week in weeks:
225 | # Pull team and matchup data from the URL
226 | matchup_response = requests.get(self.base_url,
227 | params={"leagueId": self.league_id,
228 | "seasonId": self.year,
229 | "matchupPeriodId": week,
230 | "view": "mMatchup"},
231 | cookies=self.cookies)
232 |
233 | team_response = requests.get(self.base_url,
234 | params={"leagueId": self.league_id,
235 | "seasonId": self.year,
236 | "matchupPeriodId": week,
237 | "view": "mTeam"},
238 | cookies=self.cookies)
239 |
240 | # Transform the response into a json
241 | matchup_json = matchup_response.json()
242 | team_json = team_response.json()
243 |
244 | # Transform both of the json outputs into DataFrames
245 | matchup_df = pd.json_normalize(matchup_json['schedule'])
246 | team_df = pd.json_normalize(team_json['teams'])
247 |
248 | # Define the column names needed
249 | matchup_column_names = {
250 | 'matchupPeriodId': 'Week',
251 | 'away.teamId': 'Team1',
252 | 'away.totalPoints': 'Score1',
253 | 'home.teamId': 'Team2',
254 | 'home.totalPoints': 'Score2',
255 | }
256 |
257 | team_column_names = {
258 | 'id': 'id',
259 | 'location': 'Name1',
260 | 'nickname': 'Name2'
261 | }
262 |
263 | # Reindex based on column names defined above
264 | matchup_df = matchup_df.reindex(columns=matchup_column_names).rename(
265 | columns=matchup_column_names)
266 | team_df = team_df.reindex(columns=team_column_names).rename(
267 | columns=team_column_names)
268 |
269 | # Add a new column for regular/playoff game based on week number
270 | matchup_df['Type'] = ['Regular' if week <=
271 | 13 else 'Playoff' for week in matchup_df['Week']]
272 |
273 | # Concatenate the two name columns
274 | team_df['Name'] = team_df['Name1'] + ' ' + team_df['Name2']
275 |
276 | # Drop all columns except id and Name
277 | team_df = team_df.filter(['id', 'Name'])
278 |
279 | # (1) Rename Team1 column to id
280 | matchup_df = matchup_df.rename(columns={"Team1": "id"})
281 |
282 | # (1) Merge DataFrames to get team names instead of ids and rename Name column to Name1
283 | matchup_df = matchup_df.merge(team_df, on=['id'], how='left')
284 | matchup_df = matchup_df.rename(columns={'Name': 'Name1'})
285 |
286 | # (1) Drop the id column and reorder columns
287 | matchup_df = matchup_df[['Week', 'Name1',
288 | 'Score1', 'Team2', 'Score2', 'Type']]
289 |
290 | # (2) Rename Team1 column to id
291 | matchup_df = matchup_df.rename(columns={"Team2": "id"})
292 |
293 | # (2) Merge DataFrames to get team names instead of ids and rename Name column to Name2
294 | matchup_df = matchup_df.merge(team_df, on=['id'], how='left')
295 | matchup_df = matchup_df.rename(columns={'Name': 'Name2'})
296 |
297 | # (2) Drop the id column and reorder columns
298 | matchup_df = matchup_df[['Week', 'Name1',
299 | 'Score1', 'Name2', 'Score2', 'Type']]
300 |
301 | all_matchup_data.append(matchup_df)
302 |
303 | self.matchup_df = pd.concat(all_matchup_data, ignore_index=True)
304 |
305 | return self.matchup_df
306 |
307 |
--------------------------------------------------------------------------------
/example_notebook.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": 10,
6 | "id": "b58461f7-7265-4fb2-b898-ef823c9ca28b",
7 | "metadata": {},
8 | "outputs": [],
9 | "source": [
10 | "# Dependencies\n",
11 | "import pandas as pd\n",
12 | "import espnfantasyfootball as espn\n",
13 | "import requests\n",
14 | "import espnsecrets"
15 | ]
16 | },
17 | {
18 | "cell_type": "code",
19 | "execution_count": 11,
20 | "id": "2044bd00",
21 | "metadata": {},
22 | "outputs": [],
23 | "source": [
24 | "league = espn.FantasyLeague(league_id=730129, year=2020,\n",
25 | " swid=espnsecrets.swid, espn_s2=espnsecrets.espn_s2)\n"
26 | ]
27 | },
28 | {
29 | "cell_type": "code",
30 | "execution_count": 12,
31 | "id": "d57d2e7d",
32 | "metadata": {},
33 | "outputs": [],
34 | "source": [
35 | "data = league.get_league_data()"
36 | ]
37 | },
38 | {
39 | "cell_type": "code",
40 | "execution_count": 13,
41 | "id": "23bdc923",
42 | "metadata": {},
43 | "outputs": [
44 | {
45 | "data": {
46 | "text/html": [
47 | "\n",
48 | "\n",
61 | "
\n",
62 | " \n",
63 | " \n",
64 | " | \n",
65 | " Week | \n",
66 | " PlayerName | \n",
67 | " PlayerScoreActual | \n",
68 | " PlayerScoreProjected | \n",
69 | " PlayerFantasyTeam | \n",
70 | " PlayerRosterSlot | \n",
71 | " TeamName | \n",
72 | " FullName | \n",
73 | "
\n",
74 | " \n",
75 | " \n",
76 | " \n",
77 | " | 0 | \n",
78 | " 1 | \n",
79 | " Derrick Henry | \n",
80 | " 16.1 | \n",
81 | " 17.382072 | \n",
82 | " 1 | \n",
83 | " RB | \n",
84 | " Pfizer Save us | \n",
85 | " Toker Blaze | \n",
86 | "
\n",
87 | " \n",
88 | " | 1 | \n",
89 | " 1 | \n",
90 | " Aaron Jones | \n",
91 | " 17.6 | \n",
92 | " 15.289672 | \n",
93 | " 1 | \n",
94 | " RB | \n",
95 | " Pfizer Save us | \n",
96 | " Toker Blaze | \n",
97 | "
\n",
98 | " \n",
99 | " | 2 | \n",
100 | " 1 | \n",
101 | " George Kittle | \n",
102 | " 9.3 | \n",
103 | " 15.967135 | \n",
104 | " 1 | \n",
105 | " TE | \n",
106 | " Pfizer Save us | \n",
107 | " Toker Blaze | \n",
108 | "
\n",
109 | " \n",
110 | " | 3 | \n",
111 | " 1 | \n",
112 | " Robert Woods | \n",
113 | " 17.9 | \n",
114 | " 14.470935 | \n",
115 | " 1 | \n",
116 | " WR | \n",
117 | " Pfizer Save us | \n",
118 | " Toker Blaze | \n",
119 | "
\n",
120 | " \n",
121 | " | 4 | \n",
122 | " 1 | \n",
123 | " JuJu Smith-Schuster | \n",
124 | " 24.9 | \n",
125 | " 14.596111 | \n",
126 | " 1 | \n",
127 | " WR | \n",
128 | " Pfizer Save us | \n",
129 | " Toker Blaze | \n",
130 | "
\n",
131 | " \n",
132 | " | ... | \n",
133 | " ... | \n",
134 | " ... | \n",
135 | " ... | \n",
136 | " ... | \n",
137 | " ... | \n",
138 | " ... | \n",
139 | " ... | \n",
140 | " ... | \n",
141 | "
\n",
142 | " \n",
143 | " | 157 | \n",
144 | " 17 | \n",
145 | " Preston Williams | \n",
146 | " 0.0 | \n",
147 | " 0.000000 | \n",
148 | " 14 | \n",
149 | " Bench | \n",
150 | " Edinburgh Chubby chasers | \n",
151 | " John Meier | \n",
152 | "
\n",
153 | " \n",
154 | " | 158 | \n",
155 | " 17 | \n",
156 | " Zane Gonzalez | \n",
157 | " 0.0 | \n",
158 | " 0.000000 | \n",
159 | " 14 | \n",
160 | " K | \n",
161 | " Edinburgh Chubby chasers | \n",
162 | " John Meier | \n",
163 | "
\n",
164 | " \n",
165 | " | 159 | \n",
166 | " 17 | \n",
167 | " Cowboys D/ST | \n",
168 | " 12.1 | \n",
169 | " 12.143736 | \n",
170 | " 14 | \n",
171 | " Bench | \n",
172 | " Edinburgh Chubby chasers | \n",
173 | " John Meier | \n",
174 | "
\n",
175 | " \n",
176 | " | 160 | \n",
177 | " 17 | \n",
178 | " Myles Gaskin | \n",
179 | " 17.7 | \n",
180 | " 16.453915 | \n",
181 | " 14 | \n",
182 | " Bench | \n",
183 | " Edinburgh Chubby chasers | \n",
184 | " John Meier | \n",
185 | "
\n",
186 | " \n",
187 | " | 161 | \n",
188 | " 17 | \n",
189 | " J.D. McKissic | \n",
190 | " 8.0 | \n",
191 | " 13.152776 | \n",
192 | " 14 | \n",
193 | " RB | \n",
194 | " Edinburgh Chubby chasers | \n",
195 | " John Meier | \n",
196 | "
\n",
197 | " \n",
198 | "
\n",
199 | "
2757 rows × 8 columns
\n",
200 | "
"
201 | ],
202 | "text/plain": [
203 | " Week PlayerName PlayerScoreActual PlayerScoreProjected \\\n",
204 | "0 1 Derrick Henry 16.1 17.382072 \n",
205 | "1 1 Aaron Jones 17.6 15.289672 \n",
206 | "2 1 George Kittle 9.3 15.967135 \n",
207 | "3 1 Robert Woods 17.9 14.470935 \n",
208 | "4 1 JuJu Smith-Schuster 24.9 14.596111 \n",
209 | ".. ... ... ... ... \n",
210 | "157 17 Preston Williams 0.0 0.000000 \n",
211 | "158 17 Zane Gonzalez 0.0 0.000000 \n",
212 | "159 17 Cowboys D/ST 12.1 12.143736 \n",
213 | "160 17 Myles Gaskin 17.7 16.453915 \n",
214 | "161 17 J.D. McKissic 8.0 13.152776 \n",
215 | "\n",
216 | " PlayerFantasyTeam PlayerRosterSlot TeamName \\\n",
217 | "0 1 RB Pfizer Save us \n",
218 | "1 1 RB Pfizer Save us \n",
219 | "2 1 TE Pfizer Save us \n",
220 | "3 1 WR Pfizer Save us \n",
221 | "4 1 WR Pfizer Save us \n",
222 | ".. ... ... ... \n",
223 | "157 14 Bench Edinburgh Chubby chasers \n",
224 | "158 14 K Edinburgh Chubby chasers \n",
225 | "159 14 Bench Edinburgh Chubby chasers \n",
226 | "160 14 Bench Edinburgh Chubby chasers \n",
227 | "161 14 RB Edinburgh Chubby chasers \n",
228 | "\n",
229 | " FullName \n",
230 | "0 Toker Blaze \n",
231 | "1 Toker Blaze \n",
232 | "2 Toker Blaze \n",
233 | "3 Toker Blaze \n",
234 | "4 Toker Blaze \n",
235 | ".. ... \n",
236 | "157 John Meier \n",
237 | "158 John Meier \n",
238 | "159 John Meier \n",
239 | "160 John Meier \n",
240 | "161 John Meier \n",
241 | "\n",
242 | "[2757 rows x 8 columns]"
243 | ]
244 | },
245 | "execution_count": 13,
246 | "metadata": {},
247 | "output_type": "execute_result"
248 | }
249 | ],
250 | "source": [
251 | "data"
252 | ]
253 | },
254 | {
255 | "cell_type": "code",
256 | "execution_count": 14,
257 | "id": "635ceb7f",
258 | "metadata": {},
259 | "outputs": [],
260 | "source": [
261 | "matchups = league.get_matchup_data()"
262 | ]
263 | },
264 | {
265 | "cell_type": "code",
266 | "execution_count": 15,
267 | "id": "730fef1b",
268 | "metadata": {},
269 | "outputs": [
270 | {
271 | "data": {
272 | "text/html": [
273 | "\n",
274 | "\n",
287 | "
\n",
288 | " \n",
289 | " \n",
290 | " | \n",
291 | " Week | \n",
292 | " Name1 | \n",
293 | " Score1 | \n",
294 | " Name2 | \n",
295 | " Score2 | \n",
296 | " Type | \n",
297 | "
\n",
298 | " \n",
299 | " \n",
300 | " \n",
301 | " | 0 | \n",
302 | " 1 | \n",
303 | " Edinburgh Chubby chasers | \n",
304 | " 93.49 | \n",
305 | " The Masked Singers | \n",
306 | " 135.95 | \n",
307 | " Regular | \n",
308 | "
\n",
309 | " \n",
310 | " | 1 | \n",
311 | " 1 | \n",
312 | " Happy Hanukkah | \n",
313 | " 146.31 | \n",
314 | " The Cumbacks | \n",
315 | " 130.68 | \n",
316 | " Regular | \n",
317 | "
\n",
318 | " \n",
319 | " | 2 | \n",
320 | " 1 | \n",
321 | " Titsburgh Feelers | \n",
322 | " 145.97 | \n",
323 | " Hooked on a Thielen | \n",
324 | " 181.15 | \n",
325 | " Regular | \n",
326 | "
\n",
327 | " \n",
328 | " | 3 | \n",
329 | " 1 | \n",
330 | " Gonq Unicorns | \n",
331 | " 153.85 | \n",
332 | " 3rd Place Pays Out | \n",
333 | " 89.58 | \n",
334 | " Regular | \n",
335 | "
\n",
336 | " \n",
337 | " | 4 | \n",
338 | " 1 | \n",
339 | " Tame Klonger | \n",
340 | " 111.03 | \n",
341 | " Pfizer Save us | \n",
342 | " 149.84 | \n",
343 | " Regular | \n",
344 | "
\n",
345 | " \n",
346 | " | ... | \n",
347 | " ... | \n",
348 | " ... | \n",
349 | " ... | \n",
350 | " ... | \n",
351 | " ... | \n",
352 | " ... | \n",
353 | "
\n",
354 | " \n",
355 | " | 1287 | \n",
356 | " 15 | \n",
357 | " Gonq Unicorns | \n",
358 | " 128.72 | \n",
359 | " The Masked Singers | \n",
360 | " 119.15 | \n",
361 | " Playoff | \n",
362 | "
\n",
363 | " \n",
364 | " | 1288 | \n",
365 | " 15 | \n",
366 | " Hooked on a Thielen | \n",
367 | " 114.22 | \n",
368 | " Pfizer Save us | \n",
369 | " 168.56 | \n",
370 | " Playoff | \n",
371 | "
\n",
372 | " \n",
373 | " | 1289 | \n",
374 | " 15 | \n",
375 | " Titsburgh Feelers | \n",
376 | " 160.07 | \n",
377 | " Tame Klonger | \n",
378 | " 143.83 | \n",
379 | " Playoff | \n",
380 | "
\n",
381 | " \n",
382 | " | 1290 | \n",
383 | " 15 | \n",
384 | " 3rd Place Pays Out | \n",
385 | " 70.81 | \n",
386 | " Edinburgh Chubby chasers | \n",
387 | " 123.26 | \n",
388 | " Playoff | \n",
389 | "
\n",
390 | " \n",
391 | " | 1291 | \n",
392 | " 15 | \n",
393 | " The Cumbacks | \n",
394 | " 84.00 | \n",
395 | " Happy Hanukkah | \n",
396 | " 155.73 | \n",
397 | " Playoff | \n",
398 | "
\n",
399 | " \n",
400 | "
\n",
401 | "
1292 rows × 6 columns
\n",
402 | "
"
403 | ],
404 | "text/plain": [
405 | " Week Name1 Score1 Name2 \\\n",
406 | "0 1 Edinburgh Chubby chasers 93.49 The Masked Singers \n",
407 | "1 1 Happy Hanukkah 146.31 The Cumbacks \n",
408 | "2 1 Titsburgh Feelers 145.97 Hooked on a Thielen \n",
409 | "3 1 Gonq Unicorns 153.85 3rd Place Pays Out \n",
410 | "4 1 Tame Klonger 111.03 Pfizer Save us \n",
411 | "... ... ... ... ... \n",
412 | "1287 15 Gonq Unicorns 128.72 The Masked Singers \n",
413 | "1288 15 Hooked on a Thielen 114.22 Pfizer Save us \n",
414 | "1289 15 Titsburgh Feelers 160.07 Tame Klonger \n",
415 | "1290 15 3rd Place Pays Out 70.81 Edinburgh Chubby chasers \n",
416 | "1291 15 The Cumbacks 84.00 Happy Hanukkah \n",
417 | "\n",
418 | " Score2 Type \n",
419 | "0 135.95 Regular \n",
420 | "1 130.68 Regular \n",
421 | "2 181.15 Regular \n",
422 | "3 89.58 Regular \n",
423 | "4 149.84 Regular \n",
424 | "... ... ... \n",
425 | "1287 119.15 Playoff \n",
426 | "1288 168.56 Playoff \n",
427 | "1289 143.83 Playoff \n",
428 | "1290 123.26 Playoff \n",
429 | "1291 155.73 Playoff \n",
430 | "\n",
431 | "[1292 rows x 6 columns]"
432 | ]
433 | },
434 | "execution_count": 15,
435 | "metadata": {},
436 | "output_type": "execute_result"
437 | }
438 | ],
439 | "source": [
440 | "matchups"
441 | ]
442 | },
443 | {
444 | "cell_type": "code",
445 | "execution_count": null,
446 | "id": "18d95468",
447 | "metadata": {},
448 | "outputs": [],
449 | "source": []
450 | }
451 | ],
452 | "metadata": {
453 | "kernelspec": {
454 | "display_name": "Python 3.9.7 ('base')",
455 | "language": "python",
456 | "name": "python3"
457 | },
458 | "language_info": {
459 | "codemirror_mode": {
460 | "name": "ipython",
461 | "version": 3
462 | },
463 | "file_extension": ".py",
464 | "mimetype": "text/x-python",
465 | "name": "python",
466 | "nbconvert_exporter": "python",
467 | "pygments_lexer": "ipython3",
468 | "version": "3.9.7"
469 | },
470 | "vscode": {
471 | "interpreter": {
472 | "hash": "838e51ec53c769d56e1cc4cb363682f0a508bbcae9a91bec1df886143b87e50b"
473 | }
474 | }
475 | },
476 | "nbformat": 4,
477 | "nbformat_minor": 5
478 | }
479 |
--------------------------------------------------------------------------------