Was playing around with some charting with the Altair library. Everything was going well until I hit this error when using some of the sample code.
Currently running streamlit v 1.9.0
Python v 3.8.13
macOS
Offending code:
movies_df = pd.read_json(vega_data.movies.url)
...Lots more code here, but nothing relevant
st.altair_chart(alt.Chart(movies_df).mark_point(filled=True)
StreamlitAPIException: (“Expected bytes, got a ‘int’ object”, ‘Conversion failed for column xxx with type object’)
To fix this, I had to add the following to my ~/.streamlit/config.toml file (you might have to create it)
[global] dataFrameSerialization = “legacy”
Some research suggests that this is the issue:
and that streamlit 0.85.0 was the initial version impacted by this.
This seems to be related to this topic as well.