Streamlit did not show the plotly.express pie chart

dear boss see my code
it run with out error but streamlit did not show the plotly.express pie chart i give the value by variable please see my code and give me right solution

import pandas as pd
import streamlit as st
import plotly.express as px

df = pd.DataFrame(
{
“stName”: [“Aparna”] * 5 + [“Juhi”] * 5 + [“Suprabhat”] * 5,
“stfName”: [“fdfsAparna”] * 5 + [“Jsdfuhi”] * 5 + [“Ssdfuprabhat”] * 5,
“votes”: [12, 9, 17, 19, 20, 11, 15, 12, 9, 4, 22, 19, 17, 19, 18],
} )

st.write(df)
colv = df.shape[1]
coln1 = df.columns[0]
coln2 = df.columns[colv-1]

fig = px.pie(df, values=[coln1], names=[coln1], title=‘Population of European continent’)
st.plotly_chart(fig)

You have some small errors in your code – px.pie is expecting 1 string for values, and one string for names, and the values one needs to be columns[2], not columns[0].

After that it works fine

import pandas as pd
import plotly.express as px
import streamlit as st

df = pd.DataFrame(
    {
        "stName": ["Aparna"] * 5 + ["Juhi"] * 5 + ["Suprabhat"] * 5,
        "stfName": ["fdfsAparna"] * 5 + ["Jsdfuhi"] * 5 + ["Ssdfuprabhat"] * 5,
        "votes": [12, 9, 17, 19, 20, 11, 15, 12, 9, 4, 22, 19, 17, 19, 18],
    }
)

st.write(df)
colv = df.shape[1]
coln1 = df.columns[2]
coln2 = df.columns[colv - 2]

fig = px.pie(df, values=coln1, names=coln2, title="Population of European continent")

thank you for your reply but no good new
same result no show the graph in streamlit