Hi, i am trying to have a number format with 2 decimals si i use (for column pourc_actif_inv) :
st.dataframe(portef[['lib_court_valeur_inv', 'name_categ', 'valeur_bourse_dev_ref', 'pourc_actif_inv']]
.sort_values('pourc_actif_inv', ascending=False)
.style
.format({"valeur_bourse_dev_ref": human_format}),
use_container_width=True,
hide_index=True,
column_config={"lib_court_valeur_inv": "Nom du fonds",
"name_categ": "Nom de la catégorie",
"valeur_bourse_dev_ref": st.column_config.NumberColumn("Montant en €"),
"pourc_actif_inv": st.column_config.NumberColumn("Poids en %", format="%.2f")
},
)
but the outupt is still a long format number with many digits…
I have an error message in the console :
2024-03-28 17:59:45.112 Serialization of dataframe to Arrow table was unsuccessful due to: ("Could not convert dtype('O') with type numpy.dtypes.ObjectDType: did not recognize Python value type when inferring an Arrow data type", 'Conversion failed for column 0 with type object'). Applying automatic fixes for column types to make the dataframe Arrow-compatible.
Moreover,
i would like to add a column to the dataframe that i print and store its value in a new variable (weight input).
How can i do that ?