How to position a table in the center

I am building my web app with tables of data and plots.
However, everytime I try to visualize data they are always put at the left corner.
If I want to optimise the space of the page I may want to put two table side by side or if I only have one table, to put it in the center.
Therefore the question is: is there a way to tell st.write or st.plotly_chart where you want to position (left, right, center) your table/graph?

By default, tables/plots will always be displayed in the center unless we change it. In streamlit version 0.65.0, you can specify layout as wide or centered
Pls refer to :


Not sure whether it solves your purpose…Pls give it a try if you haven’t already

Thanks for answering.
Well “By default, tables/plots will always be displayed in the center unless we change it.” this seems not to be true because in my case the table I want to write is on the left side, not in the center.
My code for that is


maybe I should use another command rather than write, no idea.
Anyway your suggestion does not solve the issue because that is referred to all the elements in the page and also it only applies to figures not to my previous command, my table still remains on the left.
Any other suggestions? Thanks!

Are you using any css? or changing layout through html tags in st.markdown(***, unsafe_allow_html=True)? If its not being used, I am not quite sure about this weird behavior…

Positioning can be mentioned through st.markdown. eg) How to center images, Latex header, title etc.?

I am getting center formatted table with those 3 lines of code as expected.
Pls find below
import streamlit as st
import pandas as pd
df = pd.read_csv("***.csv")

With my limited knowledge, these are the only suggestions :frowning:

Thanks for answering.
No I am not using any css or html it is simply a streamilit/python code
I think your table seems in the middle just because it is long, if you only plot the first column I guess you will get a situation like mine,

with the table on the left side

Got it. Probably for now you could use a Transpose…st.write(df.describe().T) to get the table visibility in the center as you expect for such dataframe describe.

Some one else from the community might be of help…

yes that can be an option
Thanks for helping

Had a same problem. Passing (casting) dataframe as type ‘object’ solved it or in fact workaround it (table got wide, hence not looking left aligned).
Eg. st.write(df.astype(‘object’))