Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Challenge: Analyze Weekly Sales Data | Data Analysis for Operations Decisions
Python for Operations Managers

bookChallenge: Analyze Weekly Sales Data

As an operations manager, you have learned how to use pandas to organize and analyze your operational data, and matplotlib to visualize key metrics for better decision making. In this challenge, you will apply these skills to a typical scenario: analyzing a week's worth of sales data to extract actionable insights. By leveraging pandas for data aggregation and matplotlib for visualization, you can quickly summarize performance, identify top-selling products, and communicate findings clearly to your team.

12345678910111213141516171819
import pandas as pd # Example DataFrame for a week's sales data = { 'day': ['Mon', 'Mon', 'Tue', 'Tue', 'Wed', 'Wed', 'Thu', 'Thu', 'Fri', 'Fri', 'Sat', 'Sat', 'Sun', 'Sun'], 'item': ['Widget', 'Gadget', 'Widget', 'Gadget', 'Widget', 'Gadget', 'Widget', 'Gadget', 'Widget', 'Gadget', 'Widget', 'Gadget', 'Widget', 'Gadget'], 'units_sold': [10, 5, 12, 8, 7, 6, 15, 9, 14, 7, 13, 8, 11, 6], 'revenue': [100, 75, 120, 120, 70, 90, 150, 135, 140, 105, 130, 120, 110, 90] } df = pd.DataFrame(data) # Example summary calculations total_revenue = df['revenue'].sum() best_selling_item = df.groupby('item')['units_sold'].sum().idxmax() print(f"Weekly Sales Summary") print(f"---------------------") print(f"Total Revenue: ${total_revenue}") print(f"Best-Selling Item: {best_selling_item}")
copy

When working with sales data for operational decisions, it is important to aggregate key metrics such as total revenue and units sold by item. Using pandas, you can easily group and sum data to pinpoint top performers. Visualizations like bar charts created with matplotlib make it easier to spot trends and communicate results to stakeholders. Always ensure your summary reports are clear, concise, and tailored to the needs of your audience.

Taak

Swipe to start coding

Write a Python script to analyze and visualize weekly sales data for operations management decisions.

  • Calculate the total revenue for the week using the revenue column of the DataFrame.
  • Identify the best-selling item based on total units_sold for each item.
  • Plot a bar chart showing total units sold per item using matplotlib.
  • Print a summary report displaying the total revenue and the best-selling item.

Oplossing

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 5
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

close

bookChallenge: Analyze Weekly Sales Data

Veeg om het menu te tonen

As an operations manager, you have learned how to use pandas to organize and analyze your operational data, and matplotlib to visualize key metrics for better decision making. In this challenge, you will apply these skills to a typical scenario: analyzing a week's worth of sales data to extract actionable insights. By leveraging pandas for data aggregation and matplotlib for visualization, you can quickly summarize performance, identify top-selling products, and communicate findings clearly to your team.

12345678910111213141516171819
import pandas as pd # Example DataFrame for a week's sales data = { 'day': ['Mon', 'Mon', 'Tue', 'Tue', 'Wed', 'Wed', 'Thu', 'Thu', 'Fri', 'Fri', 'Sat', 'Sat', 'Sun', 'Sun'], 'item': ['Widget', 'Gadget', 'Widget', 'Gadget', 'Widget', 'Gadget', 'Widget', 'Gadget', 'Widget', 'Gadget', 'Widget', 'Gadget', 'Widget', 'Gadget'], 'units_sold': [10, 5, 12, 8, 7, 6, 15, 9, 14, 7, 13, 8, 11, 6], 'revenue': [100, 75, 120, 120, 70, 90, 150, 135, 140, 105, 130, 120, 110, 90] } df = pd.DataFrame(data) # Example summary calculations total_revenue = df['revenue'].sum() best_selling_item = df.groupby('item')['units_sold'].sum().idxmax() print(f"Weekly Sales Summary") print(f"---------------------") print(f"Total Revenue: ${total_revenue}") print(f"Best-Selling Item: {best_selling_item}")
copy

When working with sales data for operational decisions, it is important to aggregate key metrics such as total revenue and units sold by item. Using pandas, you can easily group and sum data to pinpoint top performers. Visualizations like bar charts created with matplotlib make it easier to spot trends and communicate results to stakeholders. Always ensure your summary reports are clear, concise, and tailored to the needs of your audience.

Taak

Swipe to start coding

Write a Python script to analyze and visualize weekly sales data for operations management decisions.

  • Calculate the total revenue for the week using the revenue column of the DataFrame.
  • Identify the best-selling item based on total units_sold for each item.
  • Plot a bar chart showing total units sold per item using matplotlib.
  • Print a summary report displaying the total revenue and the best-selling item.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 5
single

single

some-alt