Hmm I was not able to get this work for me within streamlit. Works outside of using streamlit.
EDIT: Per this discussion your suggestion does not work. However, the current workaround is to use st.table() which perhaps is what you did, but forgot to include that info, which also has some drawbacks too.