Hockey-Scraper
Hockey-Scraper copied to clipboard
Merging Pbp and Shifts Data
Some people were discussing this topic on twitter today and I had this lying around so I figured I may as well push it. The idea here is to combine the pbp and shifts into one DataFrame for ease of use. As of right now this only lives on my dev branch.
Here is how it works:
import hockey_scraper as hs
data = hs.scrape_games([2019020001, 2019020003, 2019020003], True, data_format='pandas')
merged_data = hs.utils.merge(data['pbp'], data['shifts'])
I've written this over a year ago and haven't really tested it too well so use at your own risk. The code could likely be cleaned up as well. If you use it let me know how it works. If you find any issues please let me know (in this thread) or feel free to open a merge request.
It tells me that there is no merge: "AttributeError: module 'hockey_scraper.utils' has no attribute 'merge'"
Hi @delara38 ,
The reason why was because I accidentally uncommented the import statement in the hs.utils._init_.py file. I just added it back in and pushed the commit to master. Thanks for the heads up!
Regards, Harry
Would you be willing to update the pypi version to also contain this so I could also use the feature in google colab/jupyter notebooks.
Really appreciate the entire package already. Thanks, Nathan
Hey @delara38,
Sorry, I must have missed your last comment.
I just updated it on pypi. I do want to be clear though that this is an experimental feature that I can't vouch for. So I guess use at your own risk.
Regards, Harry