Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Using interoperability to load baseball data into Julia
# 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