Align center string column in st.dataframe

I have a st.dataframe and I would like to be able to center a string column, but the method seems to not allow it. Is there a way?

What do you mean by center a string column? Also, please share the code snippet so we can help troubleshoot it for you.

Consider the following example:

import pandas as pd
import streamlit as st

st.dataframe(pd.DataFrame({‘hello’: [‘a’, ‘b’, ‘c’], ‘world’: [4, 5, 6]}),
column_config = {‘hello’: {‘alignment’: ‘center’}, ‘world’: {‘alignment’: ‘center’}})

The column “hello” is a string column and doesn’t get aligned, but the “world” column does. My goal would be to align the string column

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.