-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce6f892
commit 37cee5a
Showing
9 changed files
with
47 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ dist | |
*.egg-info | ||
.coverage | ||
.~lock.example* | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
import hockeydata | ||
|
||
from hockeydata import get_game_shifts, get_season_play_by_play, get_play_by_plays, list_games | ||
from hockeydata.output import json, csv | ||
|
||
def main(): | ||
# get today's games ids | ||
game_list = list_games('2018-01-01', '2019-01-01') | ||
|
||
# get a full year of games id | ||
game_list = list_games('2018-01-01', '2019-01-01') | ||
|
||
# get play by play data for a game | ||
pbp = get_play_by_plays('2018021000') | ||
|
||
|
||
|
||
# get shift data for a game | ||
shifts = get_game_shifts('2018021000') | ||
|
||
# use the formatters to put your data in different formats (you could just use pandas builtin functions if you want :) ) | ||
pbp_json = json.dumps(pbp) | ||
pbp_csv = csv.dumps(pbp) | ||
|
||
pbp_dict = json.to_dict(pbp) | ||
|
||
#shifts = hockeydata.get_game_shifts('2018020028') | ||
#res = hockeydata.get_season_play_by_play(2018) | ||
#print(res) | ||
# initializing dictionary | ||
old_dict = { | ||
"N.J": 1, "NYI": 2, "NYR": 3, "PHI": 4, "PIT": 5, "BOS": 6, "BUF": 7, "MTL": 8, "OTT": 9, "TOR": 10, "ATL": 11, "CAR": 12, "FLA": 13, "T.B": 14, | ||
"WSH": 15, "CHI": 16, "DET": 17, "NSH": 18, "STL": 19, "CGY": 20, "COL": 21, "EDM": 22, "VAN": 23, "ANA": 24, "DAL": 25, "L.A": 26, "ARI": 27, "S.J": 28, | ||
"CBJ": 29, "MIN": 30, "WPG": 52, "ARI": 53, "VGK": 54 | ||
} | ||
|
||
new_dict = dict([(value, key) for key, value in old_dict.items()]) | ||
|
||
# Printing original dictionary | ||
print ("Original dictionary is : ") | ||
print(old_dict) | ||
|
||
print() | ||
|
||
# Printing new dictionary after swapping keys and values | ||
print ("Dictionary after swapping is : ") | ||
print("keys: values") | ||
for i in new_dict: | ||
print(i, " : ", new_dict[i]) | ||
print(pbp_dict) | ||
# dump it to a file if you want | ||
# pbp_json = json.dump(pbp, file_handle) | ||
# pbp_csv = csv.dump(pbp, file_handle) | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters