Thursday, March 26, 2020

Answer for Frequency error on Time Series seasonal_decompose method

https://365datascience.com/dwqa-answer/answer-for-frequency-error-on-time-series-seasonal_decompose-method/ -

Hey Sia, 

 

Thanks for reaching out!

This error occurs when the index column is not a series of dates with a set frequency (or when there are missing values). Hence, the easiest and mos straightforward solution is to fill out the data and set the frequency prior to setting the “date” column as the index.

 


df_comp = df_comp.asfreq('b')
df_comp = df_comp.fillna(method='ffill')

 

Alternatively, you can set the frequency of the dataset by setting a value for the “freq” argument of the method:


 

s_dec_training = sd(data_train.newspx, model = 'additive', freq = 'b')

 

However, that last part might not work on all versions of the statsmodels package, so I would stick with the former solution. Additionally, you can send us your Python Notebook, so we can see what’s going on. 

 

Best, 

365 Vik




#365datascience #DataScience #data #science #365datascience #BigData #tutorial #infographic #career #salary #education #howto #scientist #engineer #course #engineer #MachineLearning #machine #learning #certificate #udemy

No comments:

Post a Comment