Question

In the excel file called ’profits.xlsx’ holds the reported profits for a company in millions of...

In the excel file called ’profits.xlsx’ holds the reported profits for a company in millions of dollars. The first row of the excel file has the months of the year, the second row has each month profits for the year 2018 and the third row has the profits for the year 2019. Create a program called exam2 yourname profit that: a) Directly reads the .xlsx data file. b) In one plot display the 2018 and 2019 profits vs the months. c) Enhance the plot with title, axis labels and legends.

Homework Answers

Answer #1

The excel file 'profits.xlsx':

Python code to read excel file into a dataframe:

  import pandas as pd
  import matplotlib.pyplot as plt 
  import numpy as np

  df = pd.read_excel("profit.xlsx")
  print(df)

The Dataframe df:

Python code to plot the graphs:

plt.figure(figsize = (14,8))
plt.plot(df.iloc[0],label = "2018") # iloc is used to refer to a row in the dataframe
plt.plot(df.iloc[1], label = "2019")
plt.legend() # this will show the legend
plt.title("Company's profit for 2018 and 2019") # set the title
plt.ylabel("Profit in millions of dollars") # set the y label
plt.xlabel("Month") # set the x label

The plot:

Complete Python Code:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Please use Mat lab only. Thanks (b) Plotting Sunspots Load the Matlab data file, sunspot.dat, and...
Please use Mat lab only. Thanks (b) Plotting Sunspots Load the Matlab data file, sunspot.dat, and experiment with making plots and subplots. The file is a simple 288 row by 2 column matrix where the first column has consecutive years from 1700 until 1987 and the second column has the mean sunspot number for that year. Then we will construct year and spots vectors from the two columns and plot spots as a function of year. load sunspot.dat; year =...
INTRO NewForm IT is a seven-year-old IT consulting company founded in 2012 that provides services to...
INTRO NewForm IT is a seven-year-old IT consulting company founded in 2012 that provides services to small businesses in their local and regional area. NewForm employs 83 people, 61 of whom are IT professionals/ consultants. NewForm is struggling financially; it has not met its revenue projections in the last five quarters. NewForm has suffered excessive leadership turnover in the past three years. The original founders sold NewForm in 2015; one of them, James Stanton, remained on as CHRO but sold...
INTRO NewForm IT is a seven-year-old IT consulting company founded in 2012 that provides services to...
INTRO NewForm IT is a seven-year-old IT consulting company founded in 2012 that provides services to small businesses in their local and regional area. NewForm employs 83 people, 61 of whom are IT professionals/ consultants. NewForm is struggling financially; it has not met its revenue projections in the last five quarters. NewForm has suffered excessive leadership turnover in the past three years. The original founders sold NewForm in 2015; one of them, James Stanton, remained on as CHRO but sold...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From the April 2004 Issue Save Share 8.95 In 1991, Progressive Insurance, an automobile insurer based in Mayfield Village, Ohio, had approximately $1.3 billion in sales. By 2002, that figure had grown to $9.5 billion. What fashionable strategies did Progressive employ to achieve sevenfold growth in just over a decade? Was it positioned in a high-growth industry? Hardly. Auto insurance is a mature, 100-year-old industry...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how the firms resources incompetencies support the given pressures regarding costs and local responsiveness. Describe entry modes have they usually used, and whether they are appropriate for the given strategy. Any key issues in their global strategy? casestudy: Atlanta, June 17, 2014. Sea of Delta employees and their families swarmed between food trucks, amusement park booths, and entertainment venues that were scattered throughout what would...