py-Goldsberry
py-Goldsberry copied to clipboard
Documentation
Building out documentation for the package to ease use
@Danielmcintosh1 is taking the lead on putting together this documentation. Hopefully we can launch shortly after refactor is complete.
@danielmcintosh1 I have a couple of ipython notebooks I wrote in case you want to add them.
@ppop that would be great. We are working on class/method/parameter guides to make collecting data easier currently. However, we'd love to have vinettes in ipython as well.
I'll finish up sometime next week, I'm currently on holiday and the API changed a little bit with the refactoring so they need a little clean-up.
Hey guys, when you use the command (currently version 0.8.0.1) playerList = goldsberry.PlayerList(2008) It gives the error TypeError: init() takes exactly 1 argument (2 given)
Any suggestions? Additionally, I think this is all really cool and I'd love to help if you need any.
So when I updated, I changed the API
Try: playerList = goldsberry.PlayerList()
That will get you the current season players.
If you then call:
playerList.SET_parameter(Season='2008-09') playerList.GET_rawdata()
playerList will then contain the roster from 2008-09
If you want a list of a parameters you can set, call:
playerList.get_parameters()
That will return a dict of parameters you can set as well as their current value. Update any parameter with the SET command above and then repull data with the GET command
Hope this helps!
I'm working on a tutorial that explains this in slightly more detail in a jupyter notebook. I hope to get it finished and posted soon. On Mon, Feb 15, 2016 at 10:08 PM Henry Bogardus [email protected] wrote:
Hey guys, when you use the command playerList = goldsberry.PlayerList(2008) It gives the error TypeError: init() takes exactly 1 argument (2 given)
Any suggestions? Additionally, I think this is all really cool and I'd love to help if you need any.
— Reply to this email directly or view it on GitHub https://github.com/bradleyfay/py-Goldsberry/issues/10#issuecomment-184492973 .
Okay great, thanks for the quick response. And the yyyy-yy format looks more like the format I was using when I built my own module to scrape off the nba stats. Additionally, I saw that you added an jupyter notebook explaining how to build a shot chart with py-goldsberry. I tried using seaborn a couple months ago like Savvas' tutorial and then ended up just using built in matplotlib functions as they look a little cleaner when graphed and are easier to work with.
By the way, it is playerList.SET_parameters(Season='2008-09') and playerList.GET_raw_data()
In the previous version, I had a hidden function that transformed yyyy into the yyyy-yy format to make it easier. Went away with all the API helper functions and made the parameters easier to access. Working on a document that lists all the possible values, default values, and any required formats. Hopefully we'll get that into a sortable table soon as well.
I started working on the visualization notebook but got sidetracked. I would like to build that put more and even build some native plotting for shot charts into the module. That's on the road map with no set time horizon.
If you build any useful graphing functions you think would add value to the package, feel free to post a pull request. On Mon, Feb 15, 2016 at 10:19 PM Henry Bogardus [email protected] wrote:
Okay great, thanks for the quick response. And the yyyy-yy format looks more like the format I was using when I built my own module to scrape off the nba stats. Additionally, I saw that you added an iPython notebook explaining how to build a shot chart with py-goldsberry. I tried using seaborn a couple months ago like Savvas' tutorial and then ended up just using built in matplotlib functions as they look a little cleaner when graphed and are easier to work with.
— Reply to this email directly or view it on GitHub https://github.com/bradleyfay/py-Goldsberry/issues/10#issuecomment-184495873 .
Almost
Try:
players = pd.DataFrame(playerList.players())
Each class has at least 1 method that points to a specific table of data associated with the function call. I did this to try to minimize the burden put on the NBA servers by package users. On Tue, Feb 16, 2016 at 12:01 AM Henry Bogardus [email protected] wrote:
Okay great I will try. Also one more thing, how can I make the PlayerList object into a DataFrame? players = pd.DataFrame(playerList) It's throwing a DataFrame constructor not properly called error
— Reply to this email directly or view it on GitHub https://github.com/bradleyfay/py-Goldsberry/issues/10#issuecomment-184521541 .
Cool sorry found that in the code right after I posted it. Also one last thing: when attempting to pull shot data before 2015-16, like shot_charts = goldsberry.player.shot_chart(playerID, season='2010-11') or attempt to give any other parameter besides the player_id, the API states it only takes one parameter while the source code shows it has a range of Parameters. Is the shot chart object modified in the same way the PlayerList is?
You got it. Run it first to get current season. Then set the season parameter. Then repull data.
I should probably add a flag to determine whether or not pull data upon instantiating. That way if you don't want the current year data, you can instantiate the class, then set parameters, then actually get the data.
I'll actually probably change the default behavior to not pull and it will only get data once he GET data method has been run. Will avoid unnecessary calls to NBA website. On Tue, Feb 16, 2016 at 2:53 PM Henry Bogardus [email protected] wrote:
Cool sorry found that in the code right after I posted it. Also one last thing: when attempting to pull shot data before 2015-16, like shot_charts = goldsberry.player.shot_chart(playerID, season='2010-11') or attempt to give any other parameter besides the player_id, the API states it only takes one parameter while the source code shows it has a range of Parameters. Is the shot chart object modified in the same way the PlayerList is?
— Reply to this email directly or view it on GitHub https://github.com/bradleyfay/py-Goldsberry/issues/10#issuecomment-184851820 .
Hmm. And then one last thing is when attempting shot_chart = goldsberry.player.shot_chart(playerID) shot_chart.SET_parameters(season='2014-15') shot_chart.GET_raw_data() -> shots = shot_chart.chart()
results in the traceback: File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/goldsberry/player/_Player2.py", line 125, in chart return self._get_table_from_data(self._datatables, 0) AttributeError: 'shot_chart' object has no attribute '_datatables'
-> is the line that the error is rooted in
I'm not totally sure why it does this.
That's a bug that needs fixed.
Good catch On Tue, Feb 16, 2016 at 3:44 PM Henry Bogardus [email protected] wrote:
Hmm. And then one last thing is when attempting shot_chart = goldsberry.player.shot_chart(playerID) shot_chart.SET_parameters(season='2014-15') shot_chart.GET_raw_data() -> shots = shot_chart.chart()
results in the traceback: File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/goldsberry/player/_Player2.py", line 125, in chart return self._get_table_from_data(self._datatables, 0) AttributeError: 'shot_chart' object has no attribute '_datatables'
I'm not totally sure why it does this.
— Reply to this email directly or view it on GitHub https://github.com/bradleyfay/py-Goldsberry/issues/10#issuecomment-184868007 .
what a scam, please don't fall for this. Everyone stay safe xx