Tools: I Tried Streamlit For The First Time And Built An Mlb Bat Tracking...

Tools: I Tried Streamlit For The First Time And Built An Mlb Bat Tracking...

I built a web dashboard to visualize MLB bat tracking data from Baseball Savant.

It also supports English/Japanese language switching.

I used my own OSS library savant-extras to fetch the data.

It's a Python library for fetching bat tracking data from Baseball Savant. I built it because the existing pybaseball library didn't support date range filtering for this endpoint.

I wanted to share my data analysis in a visual, accessible format. Streamlit caught my eye for three reasons:

For example, this is all you need to add a dropdown to your sidebar:

Fetching data every time a user interacts with the page would be too slow. @st.cache_data caches the result so repeated calls with the same arguments return instantly.

Streamlit reruns the entire script on every user interaction. To keep data loaded after pressing a button, use st.session_state:

To render Japanese labels in matplotlib charts, I used matplotlib-fontja:

After deploying to Streamlit Community Cloud, I got this error:

Source: Dev.to