DateTimeIndex 만들기
DatetimeIndex는 여러 면에서 유용해요. 대괄호 표기법으로 임의의 기간을 쉽게 선택할 수 있고, 한 줄의 코드만으로 선 그래프를 만들 수도 있어요.
Date가 datetime 열로 로드된 apple 주가 데이터셋으로 이러한 작업을 연습해 보세요.
이 연습은 강의의 일부입니다
Python으로 배우는 이상치 탐지
연습 안내
appleDataFrame에서Date열을 인덱스로 설정하세요.- 2008년 7월 초부터 2013년 12월 9일까지 Apple 주식의
Open열에 대해 빨간색 선 그래프를 그리세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Set the Date column as a DatetimeIndex
apple.____(____)
# Plot the opening prices for the instructed range
apple____
plt.title("Opening prices of Apple stocks from the beginning of July of 2008 to December of 2013.")
plt.show()