Skip to content

Instantly share code, notes, and snippets.

@BlueSCar
Last active January 8, 2020 00:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BlueSCar/e2f904cf46dcbc2204e8d98a58e90a21 to your computer and use it in GitHub Desktop.
Save BlueSCar/e2f904cf46dcbc2204e8d98a58e90a21 to your computer and use it in GitHub Desktop.
Python - Normalizing /game/players endpoint
import pandas as pd
import requests
response = requests.get(
"https://api.collegefootballdata.com/games/players",
params={"year": 2019, "week": "1"}
)
records = pd.io.json.json_normalize(
response.json(),
['teams', 'categories', 'types', 'athletes'],
[
'id',
['teams', 'school'],
['teams', 'conference'],
['teams', 'categories', 'name'],
['teams', 'categories', 'types', 'name']
],
meta_prefix='game.'
)
records.head()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment