I know that Streamlit currently does not support Pandas charts, but are there any plans to include it in the future? The app already supports Pandas in almost all respects, why not this one?
Hello @GSTREAM welcome to the community!
If I recall, Pandas chart use Matplotlib under the hood (actually you can change the backend on demand but let’s not go there yet)
so you can build the Matplotlib figure, inject it in through the ax
attribute of the Pandas charting method, then display it in Streamlit:
fig, ax = plt.subplots()
df.hist(
bins=8,
column="Age",
grid=False,
figsize=(8, 8),
color="#86bf91",
zorder=2,
rwidth=0.9,
ax=ax,
)
st.pyplot(fig)
The same trick can be used for Seaborn charts
fig, ax = plt.subplots()
sns.distplot(df["Age"], ax=ax)
st.pyplot(fig)
and I suppose a lot of Matplotlib wrapper can be displayed this way.
Have a nice day,
Fanilo
Thanks, that will work! I’m new to Streamlit and Pandas, so I go by the user manual in most cases I guess I haven’t made it that far yet!