시작하기무료로 시작하기

개별 구성 요소 그리기

시계열 분해 객체에서 추정된 다른 값들도 추출할 수 있어요. 아래 코드는 관측값(observed), 추세(trend), 잡음(또는 잔차, resid) 구성 요소를 추출하는 방법을 보여줍니다.

observed = decomposition.observed
trend = decomposition.trend
residuals = decomposition.resid

이렇게 추출한 구성 요소를 이용해 각각 따로 시각화할 수 있어요.

이전 연습 문제에서 생성한 decomposition 객체가 작업 공간에 준비되어 있습니다.

이 연습은 강의의 일부입니다

Python으로 시계열 데이터 시각화

강의 보기

연습 안내

  • decomposition 객체에서 trend 구성 요소를 추출하세요.
  • 이 추세 구성 요소를 그래프로 그리세요.

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

# Extract the trend component
trend = ____.____

# Plot the values of the trend
ax = ____.____(figsize=(12, 6), fontsize=6)

# Specify axis labels
ax.set_xlabel('Date', fontsize=10)
ax.set_title('Seasonal component the CO2 time-series', fontsize=10)
plt.show()
코드 편집 및 실행