• Stars
    star
    120
  • Rank 295,983 (Top 6 %)
  • Language
    Jupyter Notebook
  • Created over 11 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

DEFUNCT - This is a python module to scrape basketball-reference.com and convert various stats into usable data structures for analysis

basketballcrawler

Join the chat at https://gitter.im/andrewgiessel/basketballcrawler

This is a python module to scrape basketball-reference.com and convert various stats into usable data structures for analysis.

Here is a link to a sample IPython Notebook file demonstrating the library.

Requirements

Usage

Still developing the API. Right now you can get a list of all player overview urls, generate a list of game log urls for a given player, and convert that list into pandas dataframe.

Notes

players.json was generated on 02/11/2016 by buildPlayerDictionary() and savePlayerDictionary(). I'd recommend building your own, fresh copy. It takes about 10 minutes to scrape from the site. To create the most recent players.json, you can use as follows.

import basketballCrawler as bc
players = bc.buildPlayerDictionary()
bc.savePlayerDictionary(players, '/path/to/file')

You can also download generated players.json. However, note that it's a pretty large (13M) file.

players = bc.loadPlayerDictionary('/path/to/players.json')

In order to search player name, use searchForName function, for example,

searched_player = bc.searchForName(players, 'Murphey') # players is player dictionary

TODO

  • Local Database construction.
  • League-wide statistics.