How can i change the label in streamlit?

here i tried to develop used car price prediction apps and deployed using streamlit.

Figure below the result of predict after i clicked the button check. i shown the labels of my dataframe, so i wanted to change the labels of “fuel_type” to “Fuel Type” and “km_driven” to “KM Driven”.

image

Here i provided my code :


I hope someone can understand what i mean

Hi @Alva_Rizky Thanks for your question. It seems that you wanted to rename your DataFrame column name. If that’s the case, you can try the following:

df.rename(columns={"fuel_type": "Fuel Type", "km_driven": "KM Driven"}, inplace=True)

What this does is rename the 2 columns in the DataFrame.

Hope this helps!

Best regards,
Chanin

It doesnt work, in this case the model has trained with training dataset and already saved in pickle file format.

this the code that i followed you

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