Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära Challenge: Compare Regional Performance | Automating Reports and Visual Insights
Python Automation for Reports and Visual Insights
Avsnitt 1. Kapitel 16
single

single

bookChallenge: Compare Regional Performance

Svep för att visa menyn

Uppgift

Svep för att börja koda

Create a function compare_regional_performance() that builds a regional sales DataFrame, computes key metrics, and prints a formatted summary.

  • Create a DataFrame with columns "Region" and "Sales" containing at least four regions and their sales values
  • Calculate total sales — the sum of the Sales column
  • Identify the region with the highest sales and its value
  • Identify the region with the lowest sales and its value
  • Print a summary that includes:
    • A header: Regional Sales Summary:
    • Total sales as: Total Sales: {value}
    • Highest performing region as: Highest Sales: {region} ({value})
    • Lowest performing region as: Lowest Sales: {region} ({value})
    • A label All Regions: followed by a table of all regions and their sales

Lösning

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 1. Kapitel 16
single

single

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

some-alt