Ex 4.5 Simple Bar Charts with Plotly Express:

Objective: Learn how to create vertical and horizontal bar charts using plotly express. Further practice aggregating data with pandas groupby() function.

  1. Create a new Jupyter Notebook file and name it Ex4.5_SimpleBarCharts.ipynb.
  2. Work through parts 1 through 4 below and submit your completed Jupyter Notebook (.ipynb) file to the first quiz question on Canvas. Your notebook should include both your code and the corresponding output that match the screengrabs provided below. Be sure to run all cells so that every output appears in the notebook.

Part 1:

  • Use the Cars.csv data file to answer the following question and create the two bar charts shown below.
    • What is the Average MSRP by Vehicle Type?

Expected output: pandas groupby DataFrame showing average MSRP by Vehicle Type from Cars.csv

 

Expected output: Plotly Express vertical bar chart showing average MSRP by Vehicle Type from Cars.csv

 

Expected output: Plotly Express horizontal bar chart showing average MSRP by Vehicle Type from Cars.csv

 

Part 2:

  • Use the Sample - Superstore.xlsx data file to answer the following question and create the bar chart shown below.
    • What are the Total Sales by Region?

Expected output: pandas groupby DataFrame showing Total Sales by Region from Sample Superstore

 

Expected output: Plotly Express bar chart showing Total Sales by Region from Sample Superstore

 

Part 3:

  • Continue using the Sample - Superstore.xlsx data file to answer the following question and create the bar chart shown below.
    • What are the Average Profits by Sub-Category?

Expected output: pandas groupby DataFrame showing Average Profits by Sub-Category from Sample Superstore

 

Expected output: Plotly Express bar chart showing Average Profits by Sub-Category from Sample Superstore

 

Part 4:

  • Continue using the Sample - Superstore.xlsx data file to answer the following question and create the bar chart shown below.
    • What are the Top 5 Customers for Total Profits?

Expected output: pandas groupby DataFrame showing Top 5 Customers by Total Profits from Sample Superstore

 

Expected output: Plotly Express bar chart showing Top 5 Customers by Total Profits from Sample Superstore