Advertisement
Alaricy

Untitled

Aug 5th, 2024
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. import pandas as pd
  2. from statsmodels.tsa.seasonal import seasonal_decompose
  3. import matplotlib.pyplot as plt
  4.  
  5. data = pd.read_csv('/datasets/energy_consumption.csv', index_col=[0], parse_dates=[0])
  6. data.sort_index(inplace=True)
  7. data = data['2018-01':'2018-06'].resample('1D').sum()
  8. decomposed = seasonal_decompose(data)
  9. seasonal_decompose(data['2018-01-01':'2018-01-15']).seasonal.plot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement