Hockey-Scraper icon indicating copy to clipboard operation
Hockey-Scraper copied to clipboard

Merging Pbp and Shifts Data

Open HarryShomer opened this issue 4 years ago • 4 comments

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.

HarryShomer avatar Nov 26 '19 01:11 HarryShomer

It tells me that there is no merge: "AttributeError: module 'hockey_scraper.utils' has no attribute 'merge'"

delara38 avatar Mar 16 '20 17:03 delara38

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

HarryShomer avatar Mar 17 '20 01:03 HarryShomer

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

delara38 avatar Mar 18 '20 16:03 delara38

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

HarryShomer avatar Mar 27 '20 01:03 HarryShomer