Upload api_scraper.py with huggingface_hub
Browse files- api_scraper.py +6 -1
api_scraper.py
CHANGED
@@ -248,6 +248,7 @@ class MLB_Scrape:
|
|
248 |
strikes_after = []
|
249 |
balls_after = []
|
250 |
outs_after = []
|
|
|
251 |
|
252 |
start_speed = []
|
253 |
end_speed = []
|
@@ -355,7 +356,8 @@ class MLB_Scrape:
|
|
355 |
else:
|
356 |
is_swing.append(None)
|
357 |
is_whiff.append(None)
|
358 |
-
|
|
|
359 |
is_ball.append(ab_list['playEvents'][n]['details']['isOut'] if 'isOut' in ab_list['playEvents'][n]['details'] else None)
|
360 |
is_review.append(ab_list['playEvents'][n]['details']['hasReview'] if 'hasReview' in ab_list['playEvents'][n]['details'] else None)
|
361 |
pitch_type.append(ab_list['playEvents'][n]['details']['type']['code'] if 'type' in ab_list['playEvents'][n]['details'] else None)
|
@@ -447,6 +449,7 @@ class MLB_Scrape:
|
|
447 |
vb.append(None)
|
448 |
ivb.append(None)
|
449 |
hb.append(None)
|
|
|
450 |
|
451 |
if 'hitData' in ab_list['playEvents'][n]:
|
452 |
launch_speed.append(ab_list['playEvents'][n]['hitData']['launchSpeed'] if 'launchSpeed' in ab_list['playEvents'][n]['hitData'] else None)
|
@@ -530,6 +533,7 @@ class MLB_Scrape:
|
|
530 |
is_review.append(None)
|
531 |
pitch_type.append(None)
|
532 |
pitch_description.append(None)
|
|
|
533 |
strikes.append(ab_list['playEvents'][n]['count']['balls'] if 'balls' in ab_list['playEvents'][n]['count'] else None)
|
534 |
balls.append(ab_list['playEvents'][n]['count']['strikes'] if 'strikes' in ab_list['playEvents'][n]['count'] else None)
|
535 |
outs.append(ab_list['playEvents'][n]['count']['outs'] if 'outs' in ab_list['playEvents'][n]['count'] else None)
|
@@ -608,6 +612,7 @@ class MLB_Scrape:
|
|
608 |
'pitcher_team':pitcher_team,
|
609 |
'pitcher_team_id':pitcher_team_id,
|
610 |
'ab_number':ab_number,
|
|
|
611 |
'play_description':play_description,
|
612 |
'play_code':play_code,
|
613 |
'in_play':in_play,
|
|
|
248 |
strikes_after = []
|
249 |
balls_after = []
|
250 |
outs_after = []
|
251 |
+
inning = []
|
252 |
|
253 |
start_speed = []
|
254 |
end_speed = []
|
|
|
356 |
else:
|
357 |
is_swing.append(None)
|
358 |
is_whiff.append(None)
|
359 |
+
|
360 |
+
inning.append(ab_list['about']['inning'] if 'inning' in ab_list['about'] else None)
|
361 |
is_ball.append(ab_list['playEvents'][n]['details']['isOut'] if 'isOut' in ab_list['playEvents'][n]['details'] else None)
|
362 |
is_review.append(ab_list['playEvents'][n]['details']['hasReview'] if 'hasReview' in ab_list['playEvents'][n]['details'] else None)
|
363 |
pitch_type.append(ab_list['playEvents'][n]['details']['type']['code'] if 'type' in ab_list['playEvents'][n]['details'] else None)
|
|
|
449 |
vb.append(None)
|
450 |
ivb.append(None)
|
451 |
hb.append(None)
|
452 |
+
|
453 |
|
454 |
if 'hitData' in ab_list['playEvents'][n]:
|
455 |
launch_speed.append(ab_list['playEvents'][n]['hitData']['launchSpeed'] if 'launchSpeed' in ab_list['playEvents'][n]['hitData'] else None)
|
|
|
533 |
is_review.append(None)
|
534 |
pitch_type.append(None)
|
535 |
pitch_description.append(None)
|
536 |
+
inning.append(None)
|
537 |
strikes.append(ab_list['playEvents'][n]['count']['balls'] if 'balls' in ab_list['playEvents'][n]['count'] else None)
|
538 |
balls.append(ab_list['playEvents'][n]['count']['strikes'] if 'strikes' in ab_list['playEvents'][n]['count'] else None)
|
539 |
outs.append(ab_list['playEvents'][n]['count']['outs'] if 'outs' in ab_list['playEvents'][n]['count'] else None)
|
|
|
612 |
'pitcher_team':pitcher_team,
|
613 |
'pitcher_team_id':pitcher_team_id,
|
614 |
'ab_number':ab_number,
|
615 |
+
'inning':inning,
|
616 |
'play_description':play_description,
|
617 |
'play_code':play_code,
|
618 |
'in_play':in_play,
|