2

I am working on some time decomposition graphing as I am looking to forecast sales data for a project. After loading in the data and dropping the columns, I have a dataframe with two columns, one for the date sold, and the other for the amount. When I tried to create a time decomposition graph, here's what I had:

    import statsmodels.api as sm
    from pylab import rcParams

    rcParams['figure.figsize'] = 18, 8
    decomposition = sm.tsa.seasonal_decompose(y, model='additive')
    fig = decomposition.plot()
    plt.show()

and the error I got:

    ValueError: x must have 2 complete cycles requires 24 observations. x only has 15 
    observation(s)

I believe it is because the data only spans 15 months (x = 15). Can anyone clarify or help me tweak the code in order to be able to plot the time decomposition? Thanks!

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.