diff --git a/pybaseball/__init__.py b/pybaseball/__init__.py index ca705827..db80a67c 100644 --- a/pybaseball/__init__.py +++ b/pybaseball/__init__.py @@ -76,7 +76,8 @@ from .lahman import salaries from .lahman import schools from .lahman import series_post -from .lahman import teams +from .lahman import teams_core +from .lahman import teams_upstream from .lahman import teams_franchises from .lahman import teams_half from .lahman import download_lahman diff --git a/pybaseball/lahman.py b/pybaseball/lahman.py index 6f197f8d..3ef7b3ab 100644 --- a/pybaseball/lahman.py +++ b/pybaseball/lahman.py @@ -9,7 +9,7 @@ from . import cache url = "https://github.com/chadwickbureau/baseballdatabank/archive/master.zip" -base_string = "baseballdatabank-master/core" +base_string = "baseballdatabank-master" _handle = None @@ -48,86 +48,89 @@ def _get_file(tablename: str, quotechar: str = "'") -> pd.DataFrame: # do this for every table in the lahman db so they can exist as separate functions def parks() -> pd.DataFrame: - return _get_file('Parks.csv') + return _get_file('core/Parks.csv') def all_star_full() -> pd.DataFrame: - return _get_file("AllstarFull.csv") + return _get_file("core/AllstarFull.csv") def appearances() -> pd.DataFrame: - return _get_file("Appearances.csv") + return _get_file("core/Appearances.csv") def awards_managers() -> pd.DataFrame: - return _get_file("AwardsManagers.csv") + return _get_file("contrib/AwardsManagers.csv") def awards_players() -> pd.DataFrame: - return _get_file("AwardsPlayers.csv") + return _get_file("contrib/AwardsPlayers.csv") def awards_share_managers() -> pd.DataFrame: - return _get_file("AwardsShareManagers.csv") + return _get_file("contrib/AwardsShareManagers.csv") def awards_share_players() -> pd.DataFrame: - return _get_file("AwardsSharePlayers.csv") + return _get_file("contrib/AwardsSharePlayers.csv") def batting() -> pd.DataFrame: - return _get_file("Batting.csv") + return _get_file("core/Batting.csv") def batting_post() -> pd.DataFrame: - return _get_file("BattingPost.csv") + return _get_file("core/BattingPost.csv") def college_playing() -> pd.DataFrame: - return _get_file("CollegePlaying.csv") + return _get_file("contrib/CollegePlaying.csv") def fielding() -> pd.DataFrame: - return _get_file("Fielding.csv") + return _get_file("core/Fielding.csv") def fielding_of() -> pd.DataFrame: - return _get_file("FieldingOF.csv") + return _get_file("core/FieldingOF.csv") def fielding_of_split() -> pd.DataFrame: - return _get_file("FieldingOFsplit.csv") + return _get_file("core/FieldingOFsplit.csv") def fielding_post() -> pd.DataFrame: - return _get_file("FieldingPost.csv") + return _get_file("core/FieldingPost.csv") def hall_of_fame() -> pd.DataFrame: - return _get_file("HallOfFame.csv") + return _get_file("contrib/HallOfFame.csv") def home_games() -> pd.DataFrame: - return _get_file("HomeGames.csv") + return _get_file("core/HomeGames.csv") def managers() -> pd.DataFrame: - return _get_file("Managers.csv") + return _get_file("core/Managers.csv") def managers_half() -> pd.DataFrame: - return _get_file("ManagersHalf.csv") + return _get_file("core/ManagersHalf.csv") def master() -> pd.DataFrame: # Alias for people -- the new name for master return people() def people() -> pd.DataFrame: - return _get_file("People.csv") + return _get_file("core/People.csv") def pitching() -> pd.DataFrame: - return _get_file("Pitching.csv") + return _get_file("core/Pitching.csv") def pitching_post() -> pd.DataFrame: - return _get_file("PitchingPost.csv") + return _get_file("core/PitchingPost.csv") def salaries() -> pd.DataFrame: - return _get_file("Salaries.csv") + return _get_file("contrib/Salaries.csv") def schools() -> pd.DataFrame: - return _get_file("Schools.csv", quotechar='"') # different here bc of doublequotes used in some school names + return _get_file("contrib/Schools.csv", quotechar='"') # different here bc of doublequotes used in some school names def series_post() -> pd.DataFrame: - return _get_file("SeriesPost.csv") + return _get_file("core/SeriesPost.csv") def teams() -> pd.DataFrame: - return _get_file("Teams.csv") + return _get_file("core/Teams.csv") + +def teams_upstream() -> pd.DataFrame: + return _get_file("upstream/Teams.csv") # manually maintained file def teams_franchises() -> pd.DataFrame: - return _get_file("TeamsFranchises.csv") + return _get_file("core/TeamsFranchises.csv") def teams_half() -> pd.DataFrame: - return _get_file("TeamsHalf.csv") + return _get_file("core/TeamsHalf.csv")