230|Python – Data Visualization Seaborn

BYU Student Author: @Carter_Lee
Reviewers: @Kyle_Nilsen, @Jacob_Dutton
Estimated Time to Solve: 30 Time Minutes

We provide the solution to this challenge using:

  • Python

Need a program? Click here.

Overview
A new fast food chain called MTasty has gathered data about each branch’s sales for the past year and has asked you to analyze the data and present the important statistics by month. MTasty has specifically asked you to present the data with a visualization.

Instructions

  • Create a new python file and import the following libaries; pandas, matplotlib and seaborn.
  • Read the CSV file into a DataFrame
  • Extract the profit data for each month from the DataFrame. You can use indexing to select the columns containing the profit data.
  • Use Matplotlib to create a line plot of the profit for each month. You can plot each month’s profit as a separate line on the graph.
  • Use Seaborn’s scatterplot() function to create a scatterplot of the profit for each month. Specify the DataFrame, x-axis (month), y-axis (profit), and hue (location) parameters.
  • Export each graph

Data Files

Suggestions and Hints
  • Slicing the dataframe by separating cities by row using the function .set_index(‘Location’, inplace=True)

Solution