Hi Iโm very sorry if this is a silly/simple question but Iโm really stucked.
I have this kind of dataframe
And i would like to plot a pie chart that shows the proportion of each event in the dataframe.
The problem is when I enter the following code I only get a blank figure :
Anyone knows what Iโm doing wrong ?
To sum this up the figure iโd like to get is the next one :
Thank you !
NiBk
June 12, 2022, 5:49pm
2
You could try making a 2nd dataframe the has the number of times each value occurs. Then pass this dataframe to the pie graph
count1 = df["event"].value_counts()
dff = pd.DataFrame()
dff["name"]=[str(i) for i in count1.index]
dff["number"] = count1.values
px.pie(dff, values="number", names="name")
Hi and thanks for your answer !
I used the same kind of trick to get the last graph but I thought px.pie had a function that count the occurences of each kind of label โฆ
Maybe itโs only with the go.Pie constructor, Iโll try it !