Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Challenge: Visualize Product vs Region Sales | Automating Reports and Visual Insights
Python Automation for Reports and Visual Insights
Sectie 1. Hoofdstuk 20
single

single

bookChallenge: Visualize Product vs Region Sales

Veeg om het menu te tonen

Taak

Veeg om te beginnen met coderen

Create a function plot_product_region_sales(data) that accepts a DataFrame with product, region, and sales columns and returns a seaborn grouped bar chart comparing sales across regions.

  • Use sns.catplot() with kind="bar" to create the chart, with region on the x-axis, sales on the y-axis, and bars grouped by product using the hue parameter.
  • Set the x-axis label to "Region" and the y-axis label to "Sales Amount" using chart.set_axis_labels().
  • Add a legend with the title "Product" using chart.add_legend(title="Product").
  • Add a chart title that includes both the words "Product" and "Region" using chart.fig.suptitle().
  • Call plt.tight_layout() to adjust the layout.
  • Return the chart object at the end of the function.

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 1. Hoofdstuk 20
single

single

Vraag AI

expand

Vraag AI

ChatGPT

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

some-alt