Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
bradleyfay committed Dec 27, 2018
2 parents 8f41351 + 1711c08 commit 9eecda4
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ target/

#Markdown README
_README.md
<<<<<<< HEAD
/.idea
=======
#Jupyter Notebook Checkpoints
*.checkpoint.ipynb
docs/.ipynb_checkpoints/
Expand All @@ -67,3 +70,4 @@ docs/.ipynb_checkpoints/



>>>>>>> master
2 changes: 1 addition & 1 deletion docs/Visualizing NBA Shots with py-Goldsberry.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,7 @@
" y_bin = _freedman_diaconis_bins(data[y])\n",
" hex_gridsize = int(np.mean([x_bin, y_bin]))\n",
"\n",
" ax.hexbin(x, y, gridsize=hex_gridsize, cmap=cmap, **kwargs)\n",
" ax.hexbin(data[x], data[y], gridsize=hex_gridsize, cmap=cmap, **kwargs)\n",
"\n",
" else:\n",
" raise ValueError(\"kind must be 'scatter', 'kde', or 'hex'.\")\n",
Expand Down
18 changes: 17 additions & 1 deletion goldsberry/league/league.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def lineups(self):
return self._get_table_from_data(self._data_tables, 0)


# Doubl Check Stem
# Double Check Stem
class playoff_picture(NbaDataProvider):
def __init__(self, **kwargs):
url_modifier = 'playoffpicture'
Expand Down Expand Up @@ -130,6 +130,22 @@ def __init__(self, **kwargs):
def clutch_stats(self):
return self._get_table_from_data(self._data_tables, 0)

class player_stats_hustle(NbaDataProvider):
def __init__(self, **kwargs):
url_modifier = 'leaguehustlestatsplayer'
NbaDataProvider.__init__(self, url_modifier=url_modifier, default_params=p_league_leaders, **kwargs)

def hustle_stats(self):
return self._get_table_from_data(self._data_tables,0)


class team_stats_hustle(NbaDataProvider):
def __init__(self, **kwargs):
url_modifier = 'leaguehustlestatsteam'
NbaDataProvider.__init__(self, url_modifier=url_modifier, default_params=p_league_leaders, **kwargs)

def hustle_stats(self):
return self._get_table_from_data(self._data_tables,0)

# class transactions(BASE):
# _pull_url = "http://stats.nba.com/feeds/NBAPlayerTransactions-559107/json.js"
Expand Down
14 changes: 12 additions & 2 deletions goldsberry/masterclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
# This library is different between python 2 and 3. This negates the difference
# noinspection PyCompatibility
from urllib.parse import urljoin
<<<<<<< HEAD
=======

>>>>>>> master

header_data = {
'Accept-Encoding': 'gzip, deflate, sdch',
Expand Down Expand Up @@ -52,7 +55,10 @@ def get_parameter_items(self):
@retrying.retry(stop_max_attempt_number=3, wait_fixed=1000,
retry_on_exception=lambda exception: isinstance(exception, _requests.ConnectionError))
def _get_nba_data(self, api_params):
<<<<<<< HEAD
=======

>>>>>>> master
pull_url = self.target_url
self._response = _requests.get(pull_url, params=api_params,
headers=header_data)
Expand All @@ -71,8 +77,12 @@ def _get_nba_data(self, api_params):

@staticmethod
def _get_table_from_data(nba_table, table_id):
headers = nba_table['resultSets'][table_id]['headers']
values = nba_table['resultSets'][table_id]['rowSet']
try:
headers = nba_table['resultSets'][table_id]['headers']
values = nba_table['resultSets'][table_id]['rowSet']
except:
headers = nba_table['resultSet'][table_id]['headers']
values = nba_table['resultSet'][table_id]['rowSet']
return [dict(zip(headers, value)) for value in values]

def _set_class_data(self):
Expand Down
3 changes: 3 additions & 0 deletions goldsberry/player/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,10 @@ def __init__(self, **kwargs):

def players(self):
return self._get_table_from_data(self._data_tables, 0)
<<<<<<< HEAD
=======

>>>>>>> master

# BLOCKED BY NBA
class shot_log(NbaDataProvider):
Expand Down

0 comments on commit 9eecda4

Please sign in to comment.