Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Challenge: Plot Sales Moving Average | Automating Reports and Visual Insights
Python Automation for Reports and Visual Insights
Sectie 1. Hoofdstuk 22
single

single

bookChallenge: Plot Sales Moving Average

Veeg om het menu te tonen

Taak

Veeg om te beginnen met coderen

Given a DataFrame containing columns for 'date' and 'sales', your task is to plot the original sales data and a 7-day moving average trend line on the same chart using matplotlib.

  • Calculate the 7-day moving average of the 'sales' column and store it as a new column in the DataFrame.
  • Plot the original sales values against their corresponding dates.
  • Plot the 7-day moving average values on the same chart.
  • Add axis labels and a title to the chart.
  • Add a legend to distinguish between the original sales and the moving average.

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 22
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