GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - JacobLee23/FanGraphs-Export: A library for scraping data off of the FanGraphs webpages.

This repository was archived by the owner on Jun 22, 2022. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

161 Commits
161 Commits

Folders and files

NameName
Last commit message
Last commit date
docs
docs
 
 
fangraphs
fangraphs
 
 
.gitignore
.gitignore
 
 
AUTHORS
AUTHORS
 
 
ChangeLog
ChangeLog
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
pyproject.toml
pyproject.toml
 
 
requirements.txt
requirements.txt
 
 
setup.cfg
setup.cfg
 
 
setup.py
setup.py
 
 

Repository files navigation

FanGraphs-Export

This package is planned to be integrated into the SABRmetrics package.

FanGraphs logo

Last Commit: master Last Commit: development

Milestone 1 Latest Release License: MIT Read the Docs

The FanGraphs website, well-known among baseball fans, provides a variety of baseball statistics. The statistics available are extremely expansive, as the website brags stats for every player in MLB history.

The fangraphs package allows for simple, intuitive parsing of the many webpages available. While not every page is "scrape-able" (i.e. the pages are most composed of graphics), there are plans for covering as many pages as possible, including the most popular ones. This package contains modules for scraping and exporting data from each of the covered webpages.

Dependencies

The fangraphs library requires Python version 3.6 or higher.

The following libraries along are required for the fangraphs library.

  • BeautifulSoup4
  • lxml
  • playwright
  • pytest
  • requests

Note: The dependencies of each package listed above are also required.

To install all the necessary packages, run:

pip install -r requirements.txt

Note: The browser binaries of playwright are needed for proper usage. To install the browser binaries, run playwright install. See the Playwright documentation for more information.

Documentation

The Read the Docs documentation can be found here.

Basic Usage

Each group of FanGraphs pages (e.g. Leaders, Projections, etc.) which is covered has an individual module. Each webpage in each group of webpages has an individual class covering the page.

Covered FanGraphs webpage groups:

  • Leaders

Leaders

FanGraphs Leaders pages:

  • Major League Leaderboards
  • Splits Leaderboards
  • Season Stat Grid
  • 60-Game Span Leaderboards
  • KBO Leaderboards
  • WAR Leaderboards
from fangraphs.leaders import leaders

mll = leaders.MajorLeague()
splits = leaders.Splits()
ssg = leaders.SeasonStat()
gsl = leaders.GameSpan()
intl = leaders.International()
war = leaders.WAR()

Tests

To run all tests, run pytest FanGraphs

To run the tests for a specific module, run pytest fangraphs/tests/test_module_name.py. For example,

pytest fangraphs/tests/test_leaders.py

To run the tests for a specific class, run pytest -k "TestClassName". For example,

pytest -k "TestMajorLeagueLeaderboards"

License

The code in this repository is licensed under an MIT License.

Copyright (c) 2021 Jacob Lee

About

A library for scraping data off of the FanGraphs webpages.

Topics

baseballbaseball-databaseball-statisticsbaseball-statsfangraphsmlbpythonpython-3python-librarypython3

Resources

Readme
MIT license
Activity

Stars

17 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.