skagr / footballdata

A collection of wrappers over football data from various websites / APIs.
MIT License
35 stars 6 forks source link

Example not working #3

Closed nicoguaro closed 6 years ago

nicoguaro commented 6 years ago

I just installed footballdata in Linux with Python 2.7. I tried to run the example

import footballdata as foo

# Create class instances
five38 = foo.FiveThirtyEight()
elo = foo.ClubElo()
mhist = foo.MatchHistory('ENG-Premier League', '2016-17')

# Create dataframes
matches = five38.read_games()
forecasts = five38.forecasts()
current_elo = elo.read_by_date()
team_elo_history = elo.read_team_history('Barcelona')
epl_2016 = mhist.read_games()

but the following error result

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-8-dc33ed877366> in <module>()
      7 
      8 # Create dataframes
----> 9 matches = five38.read_games()
     10 forecasts = five38.forecasts()
     11 current_elo = elo.read_by_date()

/home/nguarinz/anaconda2/lib/python2.7/site-packages/footballdata/FiveThirtyEight.pyc in read_games(self)
     82                 [(pd.DataFrame.from_dict(self._data[mkey])
     83                   .assign(league=lkey)
---> 84                   ) for lkey, mkey in keys]
     85             )
     86             .rename(columns=col_rename)

KeyError: 'la-liga_matches'
skagr commented 6 years ago

Hi @nicoguaro ,

This data is no longer available on fivethirtyeight.com, I have added it to the repo under /data

Put FiveThirtyEight_1617.json in a 'data' subdirectory next to your notebook and it should work.