[MLB Stats API] statsapi.game_pace_data(season=datetime.now().year, sportId=1)

2022. 1. 11. 13:16·Minding's Baseball/MLB Statcast
728x90
반응형

[MLB Stats API] 파이썬 패키지로 MLB Stats API 사용해보기

 

[MLB Stats API] 파이썬 패키지로 MLB Stats API 사용해보기

Fangraph나 MLB savant 홈페이지에서 직접 csv, DB파일을 다운로드 받는 것이 아닌 MLB서버에 연결된 API로 손쉽게 데이터를 구할 수 있는 방법을 야구공작소 글을 보며 알게되었다. 그 중 파이썬으로 API

minding-deep-learning.tistory.com


  • 요청한 특정 시즌의 경기 속도에 대한 정보 목록을 딕셔너리로 출력
  • 기본파라미터로 현재연도가 설정되어 있으나, 해당시즌을 정확히 기입하는 것이 좋음
  • 9이닝당 평균안타 / 총 경기시간 / 평균 경기시간 등 여러 데이터 제공
statsapi.game_pace_data(season=2021)
{'copyright': 'Copyright 2022 MLB Advanced Media, L.P.  Use of any content on this page acknowledges agreement to the terms posted here http://gdx.mlb.com/components/copyright.txt',
 'teams': [],
 'leagues': [],
 'sports': [{'hitsPer9Inn': 16.68,
   'runsPer9Inn': 9.3,
   'pitchesPer9Inn': 299.83,
   'plateAppearancesPer9Inn': 76.8,
   'hitsPerGame': 16.26,
   'runsPerGame': 9.06,
   'inningsPlayedPerGame': 8.8,
   'pitchesPerGame': 292.24,
   'pitchersPerGame': 8.87,
   'plateAppearancesPerGame': 74.85,
   'totalGameTime': '7749:55:59',
   'totalInningsPlayed': 21379.5,
   'totalHits': 39484,
   'totalRuns': 22010,
   'totalPlateAppearances': 181818,
   'totalPitchers': 21545,
   'totalPitches': 709851,
   'totalGames': 2429,
   'total7InnGames': 118,
   'total9InnGames': 2095,
   'totalExtraInnGames': 231,
   'timePerGame': '03:11:26',
   'timePerPitch': '00:00:39',
   'timePerHit': '00:11:46',
   'timePerRun': '00:21:07',
   'timePerPlateAppearance': '00:02:33',
   'timePer9Inn': '03:16:24',
   'timePer77PlateAppearances': '03:16:55',
   'totalExtraInnTime': '871:52:00',
   'timePer7InnGame': '02:24:52',
   'timePer7InnGameWithoutExtraInn': '253:31:59',
   'total7InnGamesScheduled': 121,
   'total7InnGamesWithoutExtraInn': 105,
   'total9InnGamesCompletedEarly': 7,
   'total9InnGamesWithoutExtraInn': 2086,
   'total9InnGamesScheduled': 2308,
   'hitsPerRun': 1.794,
   'pitchesPerPitcher': 32.947,
   'season': '2021',
   'sport': {'id': 1, 'code': 'mlb', 'link': '/api/v1/sports/1'},
   'prPortalCalculatedFields': {'total7InnGames': 118,
    'total9InnGames': 2095,
    'totalExtraInnGames': 216,
    'timePer7InnGame': '02:25:50',
    'timePer9InnGame': '03:10:04',
    'timePerExtraInnGame': '03:49:32'}}]}
728x90

'Minding's Baseball > MLB Statcast' 카테고리의 다른 글

[MLB Stats API] statsapi.league_leader_data(leaderCategories, season=None, limit=10, statGroup=None, leagueId=None, gameTypes=None, playerPool=None, sportId=1, statType=None)  (0) 2022.01.11
[MLB Stats API] statsapi.game_scoring_play_data(gamePk)  (0) 2022.01.11
[MLB Stats API] statsapi.game_highlight_data(gamePk)  (0) 2022.01.11
[MLB Stats API] statsapi.boxscore_data(gamePk, timecode=None)  (0) 2022.01.11
[MLB Stats API] statsapi.team_leaders(teamId, leaderCategories, season=datetime.now().year, leaderGameTypes="R", limit=10)  (0) 2022.01.10
'Minding's Baseball/MLB Statcast' 카테고리의 다른 글
  • [MLB Stats API] statsapi.league_leader_data(leaderCategories, season=None, limit=10, statGroup=None, leagueId=None, gameTypes=None, playerPool=None, sportId=1, statType=None)
  • [MLB Stats API] statsapi.game_scoring_play_data(gamePk)
  • [MLB Stats API] statsapi.game_highlight_data(gamePk)
  • [MLB Stats API] statsapi.boxscore_data(gamePk, timecode=None)
Minding
Minding
  • Minding
    Today's Minding
    Minding
  • 전체
    오늘
    어제
    • 울고넘는 딥러닝 (278)
      • Minding's Baseball (57)
        • MLB Statcast (29)
        • 머신러닝으로 홈런왕 예측하기 (3)
        • 야구칼럼 (12)
        • 야구 규칙, 용어 (1)
        • 2022-23 질롱 코리아 (8)
        • 류현진 등판경기 (4)
      • Minding's Programming (185)
        • 프로그래머스 코딩테스트 (21)
        • Knowledge (44)
        • Numpy & Pandas (6)
        • Excel (3)
        • Git (1)
        • Pygame (11)
        • CV (3)
        • Tensorflow tutorial (4)
        • Kaggle and Dacon (4)
        • 에러 코드 (8)
        • FastAPI (8)
        • Airflow (29)
        • Crawling (6)
        • Django (14)
        • AWS (18)
        • Spark (5)
      • Minding's Reading (30)
        • 머신러닝 딥러닝에 필요한 기초 수학 with 파이.. (2)
        • 칼만필터는 어렵지 않아 (11)
        • 밑바닥부터 시작하는 딥러닝 (6)
        • 메이저리그 야구 통계학 2e (8)
        • 논문읽기 (2)
        • 빅데이터를 지탱하는 기술 (1)
      • Minding's Life (5)
        • 주식 (4)
        • 각종 소식 (1)
  • 블로그 메뉴

    • 홈
    • Baseball
    • Programming
    • Reading
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    코딩테스트
    Airflow
    칼만필터는어렵지않아
    칼만필터
    야구
    프로그래머스
    MLB
    파이썬게임개발
    데이터분석
    AWS
    딥러닝
    FastAPI
    파이썬
    파이게임
    KBO
    django python
    게임개발
    django
    질롱코리아
    Python
    에어플로우
    데이터 엔지니어
    칼만필터는어렵지않아파이썬
    넘파이
    메이저리그
    머신러닝
    칼만필터는어렵지않아python
    pygame
    mlb stats api
    KalmanFilter
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
Minding
[MLB Stats API] statsapi.game_pace_data(season=datetime.now().year, sportId=1)
상단으로

티스토리툴바