This library scrapes specific hitter stats from BaseballReference. The purpose of this library is to provide fantasy owners a chance to see how the players in their lineup have been performing over a number of games and how they perform against a certain pitcher. This will help facilitate their daily lineup constuction and to see which players on the wire are having a hot streak as well as players that have been trending downwards.
To install, run the following:
pip install FantasyBaseballTrends
This function will return a specific hitters projected offensive stats for the 2023 season.
get2023Projected(browser, player)
This function will return all of offensive stats of a players most recent game.
getLastGame(browser, player)
This function will return a players current season hitting stats against right handed pitchers.
getVsRhpCurrent(browser, player)
This function will return a players current season hitting stats against left handed pitchers.
getVsLhpCurrent(browser, player)
This function will return a hitter's carrer splits. The returning data frame is split up by the opposing pitchers handedness and if they are a starter or not.
getCareerSplits(browser, player)
This funciton will return a hitter's stats over a user specified number of games.
getLastxGames(browser, player, gamesNum)
A sample function can look like the code below. NOTE: when using this library you must first set up the browser by using the setUpWebsite() function. The function below returns Yadier Molina's career stats.
import FantasyBaseballTrends as fbt
browser = fbt.setUpWebsite()
print(getCareer(browser, "Yadier Molina"))