Q:

Read Total profit of all months and show it using a line plot using python programming

belongs to collection: Python Matplotlib Exercises

0

Read Total profit of all months and show it using a line plot

Total profit data provided for each month. Generated line plot must include the following properties: –

  • X label name = Month Number
  • Y label name = Total profit

The line plot graph should look like this.

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")
profitList = df ['total_profit'].tolist()
monthList  = df ['month_number'].tolist()
plt.plot(monthList, profitList, label = 'Month-wise Profit data of last year')
plt.xlabel('Month number')
plt.ylabel('Profit in dollar')
plt.xticks(monthList)
plt.title('Company profit per month')
plt.yticks([100000, 200000, 300000, 400000, 500000])
plt.show()

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

total answers (1)

Read all product sales data and show it using a m... >>