Created
January 4, 2020 23:31
-
-
Save kperry2215/e8a01ac88adc60770b8690ea411ed0a9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from statsmodels.tsa.seasonal import seasonal_decompose | |
def decompose_time_series(series, frequency): | |
""" | |
Decompose a time series and plot it in the console | |
Arguments: | |
series: series. Time series that we want to decompose | |
Outputs: | |
Decomposition plot in the console | |
""" | |
result = seasonal_decompose(series, model='additive', freq = frequency) | |
result.plot() | |
plt.show() | |
### EXECUTE IN MAIN FUNCTION ### | |
#Decompose the time series to determine seasonality/trend | |
decompose_time_series(df['Geothermal_net_generation'], 12) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment