Code Monkey home page Code Monkey logo

mlb-boxscore-analysis's Introduction

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.

mlb-boxscore-analysis's People

Contributors

vincent-crescente avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.