Time Series Decomposition - How to extract monthly seasonality from daily data

49 Views Asked by At

I'm having difficulty extracting the monthly seasonality from daily data using the code below.To describe the data, the number will grow from the beginning of the month till the end of the month, then drop by a large amount before continuing to grow again. Using times series decomposition, I would expect the trend to be smooth while most of the kink in the data should be reflected in the seasonal component instead of the image attached.

How do I extract monthly instead of daily seasonality using the code please? Hope I'm explained my difficulty clearly. Thanks in advance!

Plot of the decomposition

import pandas as pd
import numpy as np
from statsmodels.tsa.seasonal import seasonal_decompose

series = "df<dataset below>"
result = seasonal_decompose(series, model='additive')



Below is a segment of the data set of daily frequency.

Date            Total 
2023-04-07  22870
2023-04-08  22870
2023-04-09  22870
2023-04-10  23181
2023-04-11  23593
2023-04-12  24139
2023-04-13  24381
2023-04-14  24188
2023-04-15  24188
2023-04-16  24188
2023-04-17  24367
2023-04-18  24919
2023-04-19  24904
2023-04-20  25049
2023-04-21  25119
2023-04-22  25119
2023-04-23  25119
2023-04-24  25296
2023-04-25  25679
2023-04-26  26076
2023-04-27  26699
2023-04-28  27083
2023-04-29  27083
2023-04-30  27083
2023-05-01  27083
2023-05-02  22326
2023-05-03  23486
2023-05-04  24087
2023-05-05  24851
2023-05-06  24851
2023-05-07  24851
2023-05-08  24879
2023-05-09  24909
2023-05-10  25149
2023-05-11  25311
2023-05-12  25491
2023-05-13  25491
2023-05-14  25491
2023-05-15  25701
2023-05-16  25807
2023-05-17  26035
2023-05-18  25953
2023-05-19  26599
2023-05-20  26599
2023-05-21  26599
2023-05-22  26509
2023-05-23  26338
2023-05-24  26533
2023-05-25  27133
2023-05-26  27067
2023-05-27  27067
2023-05-28  27067
2023-05-29  27214
2023-05-30  27432
2023-05-31  27273
2023-06-01  27516
2023-06-02  23040
2023-06-03  23040
2023-06-04  23040
2023-06-05  23354

0

There are 0 best solutions below