Show data in weekly or monthly intervals

65 views Asked by At

I am working with dataset that contains data in the following format: YYYY-WW.I converted it to this format DD-MM-YYYY, using this:

data['Date'] = data['Date'].apply(lambda x: week_to_date(x).strftime('%d-%m-%Y'))

Now I want to show the data with weekly or monthly intervals but I am getting some misleading chart that probably are wrong.

When I plot the chart, using this code:

plt.plot(data['Date'], data['Sales Volume'])

My chart looks very busy: chart

I would like to show data with weekly or monthly intervals but when I try to use resampling

data.set_index('Date', inplace=True)

monthly_data = data.resample('W').count()

plt.figure().set_figwidth(30)

plt.plot(monthly_data.index, monthly_data['Sales Volume'], label='Monthly', marker='o', linestyle='-')

My graph looks like: graph2

0

There are 0 answers