Last active
December 14, 2023 19:44
-
-
Save tjburch/364f244688e0942d5d4cb0ae28cfa053 to your computer and use it in GitHub Desktop.
Using interoperability to load baseball data into Julia
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For pybaseball (https://github.com/jldbc/pybaseball) | |
using DataFrames, PyCall, CSV | |
pybaseball = pyimport("pybaseball") | |
python_df = pybaseball.statcast("2021-04-06") | |
julia_df = CSV.read(IOBuffer(python_df.to_csv()), DataFrame) | |
# For baseballr (https://billpetti.github.io/baseballr/) | |
using RCall | |
@rlibarary baseballr | |
julia_df = rcopy(R"baseballr::scrape_statcast_savant(start_date = '2021-04-06', end_date = '2021-04-06')" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment