-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
54 lines (34 loc) · 1.86 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
I wanted to see the percentage of runs a team or teams
score in a certain inning compared to their total, giving you
the 'hot' innings of a team.
I used the MLB StatsAPI from https://pypi.org/project/MLB-StatsAPI/
using the "pip install MLB-StatsAPI" command.
There are two functions one for all teams one for a specific team:
boxscore_data_all_teams.py
boxscore_data_one_team.py
------------------------------------------------------------------------------
- After downloading -
From the command line you can:
start_date end_date
"python boxscore_data_all_teams.py "MM/DD/YYYY" "MM/DD/YYYY" "folder_path_for_xlsx"
or
"python boxscore_data_one_team.py "team name" "MM/DD/YYYY" "MM/DD/YYYY" "folder_path_for_xlsx"
or
Just run it from your IDE. Delete the 'arg.start_date' and other args
from the CL and put in strings. The 'main' is at the bottom in the try except.
The main function is boxscore_data.
----------------------------------------------------------------------------------------
General Details
* Team names are spelt specifically with proper case. Look at "teams_and_ids.py"
ex "New York Yankees", "St. Louis Cardinals", "Los Angeles Angels", "Oakland Athletics"
The columns in the exported DataFrame are:
-game id: the id the mlbstats api gives this specific game. you can use it in
other functions as well
-date: date game was played
-team: full team name
-opp: opposing team at that game
-H: Home or Away. If "Y" the team was home for this game. If "N" they were away.
-DBH: "Y" or "N" if this game was a double header. "S" is a double header
just a "split-admission" double header
-Innings (1-#) - one through max innings. Not all teams reach the max inning played of
another teams, thus they'll have zeros in those extra columns.