Q:

Calculate total sale data for last year for each product and show it using a Pie chart

belongs to collection: Python Matplotlib Exercises

0

Calculate total sale data for last year for each product and show it using a Pie chart

Note: In Pie chart display Number of units sold per year for each product in percentage.

The Pie chart should look like this.

Matplotlib Exercise 8: Calculate total sale data for last year for each product and show it using a Pie chart

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import pandas as pd
import matplotlib.pyplot as plt  

df = pd.read_csv("D:\\Python\\Articles\\matplotlib\\sales_data.csv")
monthList  = df ['month_number'].tolist()

labels = ['FaceCream', 'FaseWash', 'ToothPaste', 'Bathing soap', 'Shampoo', 'Moisturizer']
salesData   = [df ['facecream'].sum(), df ['facewash'].sum(), df ['toothpaste'].sum(), 
         df ['bathingsoap'].sum(), df ['shampoo'].sum(), df ['moisturizer'].sum()]
plt.axis("equal")
plt.pie(salesData, labels=labels, autopct='%1.1f%%')
plt.legend(loc='lower right')
plt.title('Sales data')
plt.show()

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Read Bathing soap facewash of all months and displ... >>
<< Read the total profit of each month and show it us...