I want to plot a pie chart from an categorical variable. I tried the following ways:
#example df
data = {'Category': ['waschen','anziehen','lesen', 'waschen', 'waschen', 'lesen', 'lesen'],
'T1': ['1', '2', '3','3', '5', '6', '7']}
df = pd.DataFrame(data)
#change dtype, doesn't work without
df.loc[:, 'T1']=df.loc[:, 'T1'].astype('int64')
1st try
df.groupby(by=['Category']).sum().plot.pie(y='T1', autopct='%2f');
pie chart is showing the wrong values, for "lesen" und "waschen" there must be the same value
2nd try
df.groupby('Category').count().plot.pie(y='T1', ax=ax, autopct='%2f')
only shows the following text: AxesSubplot:ylabel='T1'
I'm beginner with python and searched the last hours for a solution. Has anybody an idea?