Vivian
5/14/2020 - 7:05 AM

doughnut chart

# composition of life segment
r = df3.groupby(['life_segment'])['user_id'].count()
r = r/r.sum()

# plot pie chart
plt.pie(r, labels=r.index)
# add a circle at the center
my_circle=plt.Circle( (0,0), 0.7, color='white')
p=plt.gcf()
p.gca().add_artist(my_circle)
plt.title('Composition of life segment')
plt.show()