Trying to format to % format with st.column_config.NumberColumn()

Hi, i am trying to format a column with % format. I tried:

                 .format({"AuM": lambda x: human_format(x) + '€', 
                                          'Total en %' : '{:,.2%}'}),   
                 column_config={"GroupeCat_rng1": "Classe d'actif",
                                "GroupeCat_Specific_Dynamic": 'Zone géographique',
                                "AuM": st.column_config.NumberColumn("Actif Net"),
                                'RetYTD' : st.column_config.NumberColumn("Rendement YTD", format='%.2f %%')

but get (extraction from a part of my result):

Actions	Actions	-1.776216
Actions	Actions Amérique du Nord	12.966200
Actions	Actions Asie	7.826019

whereas I was expecting to get:

Actions	Actions	-1.77%
Actions	Actions Amérique du Nord	12.96%
Actions	Actions Asie	7.82%

Also when I try:

'RetYTD' : st.column_config.NumberColumn("Rendement YTD", format='%.1f')

I got the same result. Strange isn’t it ?

the dtypes of my data is:

RetYTD	double[pyarrow]
Ret1a	double[pyarrow]
Ret3a	double[pyarrow]
Ret5a	double[pyarrow]

Any idea ?

Looks like column configuration doesn’t work with Styler objects.

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