НачатьНачать бесплатно

Creating a DateTimeIndex

Having a DatetimeIndex is helpful for several reasons. First, you can use brackets notation to choose arbitrary time periods or write only a line of code to create line plots.

Practice these operations on the apple stocks dataset, which has been loaded with Date as a datetime column.

Это упражнение является частью курса

Anomaly Detection in Python

Посмотреть курс

Инструкции к упражнению

  • Set the Date column as the apple DataFrame's index.
  • Create a red lineplot of the Open column of Apple stocks from the beginning of July 2008 to the 9th of December 2013.

Интерактивное практическое упражнение

Попробуйте выполнить это упражнение, дополнив этот пример кода.

# 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()
Редактировать и запускать код