Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

seasonal_decompose python

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

# Generate some data
np.random.seed(0)
n = 1500
dates = np.array('2005-01-01', dtype=np.datetime64) + np.arange(n)
data = 12*np.sin(2*np.pi*np.arange(n)/365) + np.random.normal(12, 2, 1500)
df = pd.DataFrame({'data': data}, index=dates)

# Reproduce the example in OP
seasonal_decompose(df, model='additive', freq=1).plot()
Comment

PREVIOUS NEXT
Code Example
Python :: python round number numpy 
Python :: python requests token x-www-form-urlencoded 
Python :: check cuda available tensorflow 
Python :: python number of elements in multidimensional array 
Python :: python open website 
Python :: remove nan particular column pandas 
Python :: How to ungrid something tkinter 
Python :: pyqt5 qtwebenginewidgets not found 
Python :: how to equal two arrays in python with out linking them 
Python :: Savefig cuts off title 
Python :: python print time difference 
Python :: pandas sort values by multiple columns 
Python :: min max scaling pandas 
Python :: matplotlib ticksize 
Python :: create list in range 
Python :: how to add card using py-trello API 
Python :: how to send a message from google form to a python 
Python :: python round up 
Python :: flask define template folder 
Python :: python subtract 2 strings 
Python :: goal parser 
Python :: print list vertically in python with loop 
Python :: how to get the current url path in django template 
Python :: find all unique items in dictionary value python 
Python :: add path python sys 
Python :: ordered char list 
Python :: how to filter mask results in python cv2 
Python :: f string decimal places 
Python :: python discord input 
Python :: is there a python command that clears the output 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =