wsba-hockey 1.1.7__py3-none-any.whl → 1.1.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wsba_hockey/workspace.py +2 -2
- wsba_hockey/wsba_main.py +57 -74
- {wsba_hockey-1.1.7.dist-info → wsba_hockey-1.1.8.dist-info}/METADATA +1 -1
- {wsba_hockey-1.1.7.dist-info → wsba_hockey-1.1.8.dist-info}/RECORD +7 -7
- {wsba_hockey-1.1.7.dist-info → wsba_hockey-1.1.8.dist-info}/WHEEL +0 -0
- {wsba_hockey-1.1.7.dist-info → wsba_hockey-1.1.8.dist-info}/licenses/LICENSE +0 -0
- {wsba_hockey-1.1.7.dist-info → wsba_hockey-1.1.8.dist-info}/top_level.txt +0 -0
wsba_hockey/workspace.py
CHANGED
wsba_hockey/wsba_main.py
CHANGED
@@ -16,44 +16,44 @@ from wsba_hockey.tools.plotting import *
|
|
16
16
|
|
17
17
|
## GLOBAL VARIABLES ##
|
18
18
|
SEASONS = [
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
19
|
+
20072008,
|
20
|
+
20082009,
|
21
|
+
20092010,
|
22
|
+
20102011,
|
23
|
+
20112012,
|
24
|
+
20122013,
|
25
|
+
20132014,
|
26
|
+
20142015,
|
27
|
+
20152016,
|
28
|
+
20162017,
|
29
|
+
20172018,
|
30
|
+
20182019,
|
31
|
+
20192020,
|
32
|
+
20202021,
|
33
|
+
20212022,
|
34
|
+
20222023,
|
35
|
+
20232024,
|
36
|
+
20242025
|
37
37
|
]
|
38
38
|
|
39
|
-
CONVERT_SEASONS = {
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
39
|
+
CONVERT_SEASONS = {2007: 20072008,
|
40
|
+
2008: 20082009,
|
41
|
+
2009: 20092010,
|
42
|
+
2010: 20102011,
|
43
|
+
2011: 20112012,
|
44
|
+
2012: 20122013,
|
45
|
+
2013: 20132014,
|
46
|
+
2014: 20142015,
|
47
|
+
2015: 20152016,
|
48
|
+
2016: 20162017,
|
49
|
+
2017: 20172018,
|
50
|
+
2018: 20182019,
|
51
|
+
2019: 20192020,
|
52
|
+
2020: 20202021,
|
53
|
+
2021: 20212022,
|
54
|
+
2022: 20222023,
|
55
|
+
2023: 20232024,
|
56
|
+
2024: 20242025}
|
57
57
|
|
58
58
|
CONVERT_TEAM_ABBR = {'L.A':'LAK',
|
59
59
|
'N.J':'NJD',
|
@@ -66,46 +66,25 @@ PER_SIXTY = ['Fi','xGi','Gi','A1','A2','P1','P','Si','OZF','NZF','DZF','FF','FA'
|
|
66
66
|
#Some games in the API are specifically known to cause errors in scraping.
|
67
67
|
#This list is updated as frequently as necessary
|
68
68
|
KNOWN_PROBS = {
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
69
|
+
2007020011:'Missing shifts data for game between Chicago and Minnesota.',
|
70
|
+
2007021178:'Game between the Bruins and Sabres is missing data after the second period, for some reason.',
|
71
|
+
2008020259:'HTML data is completely missing for this game.',
|
72
|
+
2008020409:'HTML data is completely missing for this game.',
|
73
|
+
2008021077:'HTML data is completely missing for this game.',
|
74
|
+
2009020081:'HTML pbp for this game between Pittsburgh and Carolina is missing all but the period start and first faceoff events, for some reason.',
|
75
|
+
2009020658:'Missing shifts data for game between New York Islanders and Dallas.',
|
76
|
+
2009020885:'Missing shifts data for game between Sharks and Blue Jackets.',
|
77
|
+
2010020124:'Game between Capitals and Hurricanes is sporadically missing player on-ice data',
|
78
|
+
2012020018:'HTML events contain mislabeled events.',
|
79
|
+
2013020971:'On March 10th, 2014, Stars forward Rich Peverley suffered from a cardiac episode midgame and as a result, the remainder of the game was postponed. \nThe game resumed on April 9th, and the only goal scorer in the game, Blue Jackets forward Nathan Horton, did not appear in the resumed game due to injury. Interestingly, Horton would never play in the NHL again.',
|
80
|
+
2018021133:'Game between Lightning and Capitals has incorrectly labeled event teams (i.e. WSH TAKEAWAY - #71 CIRELLI (Cirelli is a Tampa Bay skater in this game)).',
|
81
|
+
2019020876:'Due to the frightening collapse of Blues defensemen Jay Bouwmeester, a game on February 2nd, 2020 between the Ducks and Blues was postponed. \nWhen the game resumed, Ducks defensemen Hampus Lindholm, who assisted on a goal in the inital game, did not play in the resumed match.'
|
82
82
|
}
|
83
83
|
|
84
84
|
SHOT_TYPES = ['wrist','deflected','tip-in','slap','backhand','snap','wrap-around','poke','bat','cradle','between-legs']
|
85
85
|
|
86
86
|
NEW = 2024
|
87
87
|
|
88
|
-
STANDINGS_END = {
|
89
|
-
'20072008':'04-06',
|
90
|
-
'20082009':'04-12',
|
91
|
-
'20092010':'04-11',
|
92
|
-
'20102011':'04-10',
|
93
|
-
'20112012':'04-07',
|
94
|
-
'20122013':'04-28',
|
95
|
-
'20132014':'04-13',
|
96
|
-
'20142015':'04-11',
|
97
|
-
'20152016':'04-10',
|
98
|
-
'20162017':'04-09',
|
99
|
-
'20172018':'04-08',
|
100
|
-
'20182019':'04-06',
|
101
|
-
'20192020':'03-11',
|
102
|
-
'20202021':'05-19',
|
103
|
-
'20212022':'04-01',
|
104
|
-
'20222023':'04-14',
|
105
|
-
'20232024':'04-18',
|
106
|
-
'20242025':'04-17'
|
107
|
-
}
|
108
|
-
|
109
88
|
EVENTS = ['faceoff','hit','giveaway','takeaway','blocked-shot','missed-shot','shot-on-goal','goal','penalty']
|
110
89
|
|
111
90
|
DIR = os.path.dirname(os.path.realpath(__file__))
|
@@ -455,12 +434,12 @@ def nhl_scrape_seasons_info(seasons:list[int] = []):
|
|
455
434
|
else:
|
456
435
|
return df.sort_values(by=['id'])
|
457
436
|
|
458
|
-
def nhl_scrape_standings(arg:str = "now", season_type:int = 2):
|
437
|
+
def nhl_scrape_standings(arg:str | int = "now", season_type:int = 2):
|
459
438
|
"""
|
460
439
|
Returns standings or playoff bracket
|
461
440
|
Args:
|
462
|
-
arg (str, optional):
|
463
|
-
Date formatted as 'YYYY-MM-DD' to scrape standings
|
441
|
+
arg (str or int, optional):
|
442
|
+
Date formatted as 'YYYY-MM-DD' to scrape standings, NHL season such as "20242025", or 'now' for current standings. Default is 'now'.
|
464
443
|
season_type (int, optional):
|
465
444
|
Part of season to scrape. If 3 (playoffs) then scrape the playoff bracket for the season implied by arg. When arg = 'now' this is ignored. Default is 2.
|
466
445
|
|
@@ -488,7 +467,11 @@ def nhl_scrape_standings(arg:str = "now", season_type:int = 2):
|
|
488
467
|
else:
|
489
468
|
print(f"Scraping standings for date: {arg}")
|
490
469
|
|
491
|
-
|
470
|
+
season_data = rs.get('https://api.nhle.com/stats/rest/en/season').json()['data']
|
471
|
+
season_data = [s for s in season_data if s['id'] == arg][0]
|
472
|
+
end = season_data['regularSeasonEndDate'][0:10]
|
473
|
+
|
474
|
+
api = f"https://api-web.nhle.com/v1/standings/{end}"
|
492
475
|
data = rs.get(api).json()['standings']
|
493
476
|
|
494
477
|
return pd.json_normalize(data)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: wsba_hockey
|
3
|
-
Version: 1.1.
|
3
|
+
Version: 1.1.8
|
4
4
|
Summary: WeakSide Breakout's complete Python package of access to hockey data, primairly including the scraping of National Hockey League schedule, play-by-play, and shifts information.
|
5
5
|
Author-email: Owen Singh <owenbksingh@gmail.com>
|
6
6
|
Project-URL: Homepage, https://github.com/owensingh38/wsba_hockey/
|
@@ -1,7 +1,7 @@
|
|
1
1
|
wsba_hockey/__init__.py,sha256=qye0rq22KeaUzBPH__pqjBA_igwsmHemOAbaY_G2tNY,356
|
2
2
|
wsba_hockey/data_pipelines.py,sha256=SITapG3nbea6-_EsXujMW2JBQxtRaQ33XMcE6ohn2Ko,10853
|
3
|
-
wsba_hockey/workspace.py,sha256=
|
4
|
-
wsba_hockey/wsba_main.py,sha256=
|
3
|
+
wsba_hockey/workspace.py,sha256=DrOm6DYPEmk9FEzAxpFgn_8zd0wNTca7muED0eDMdlc,968
|
4
|
+
wsba_hockey/wsba_main.py,sha256=7RJtcpqsAuSWEtxs1CgZXkfZU3GR1MJc0_HG_S7gb08,61959
|
5
5
|
wsba_hockey/api/api/index.py,sha256=r2keq105Ve8V0JAsSZMIPs9geVHX2Fuxyi4MqnzCt48,6537
|
6
6
|
wsba_hockey/evidence/weakside-breakout/node_modules/duckdb/vendor.py,sha256=lmu0TB0rIYkAuV9-csFJgW-1hJojso_-EZpEoorUUKM,4949
|
7
7
|
wsba_hockey/evidence/weakside-breakout/node_modules/flatted/python/flatted.py,sha256=ke8FuEflns-WlphCcQ9CC0qJqWqX3zEEuak74o6rgE8,3879
|
@@ -141,8 +141,8 @@ wsba_hockey/tools/utils/__init__.py,sha256=vccXhOtzARoR99fmEWU1OEI3qCIdQ9Z42AlRA
|
|
141
141
|
wsba_hockey/tools/utils/config.py,sha256=D3Uk05-YTyrhfReMTTLfNI3HN_rON2uo_CDE9oER3Lg,351
|
142
142
|
wsba_hockey/tools/utils/save_pages.py,sha256=CsyL_0n-b-4pJoUauwU3HpnCO6n69-RlBMJQBd_qGDc,4979
|
143
143
|
wsba_hockey/tools/utils/shared.py,sha256=dH_JwZfia5fib8rksy5sW-mBp0pluBPvw37Vdr8Kap0,14211
|
144
|
-
wsba_hockey-1.1.
|
145
|
-
wsba_hockey-1.1.
|
146
|
-
wsba_hockey-1.1.
|
147
|
-
wsba_hockey-1.1.
|
148
|
-
wsba_hockey-1.1.
|
144
|
+
wsba_hockey-1.1.8.dist-info/licenses/LICENSE,sha256=Nr_Um1Pd5FQJTWWgm7maZArdtYMbDhzXYSwyJIZDGik,1114
|
145
|
+
wsba_hockey-1.1.8.dist-info/METADATA,sha256=qacIIM92WbKqxYPI96wimlHYw2NLxCMZkmwTQHnO-5M,3566
|
146
|
+
wsba_hockey-1.1.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
147
|
+
wsba_hockey-1.1.8.dist-info/top_level.txt,sha256=acU7s3x-RZC1zGiqCOmO0g267iqCg34lzIfdmYxxGmQ,12
|
148
|
+
wsba_hockey-1.1.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|