MulaiMulai sekarang secara gratis

Inspecting the regression data

The next dataset contains information about company market value over several years of time. This is one of the most popular kind of time series data used for regression. If you can model the value of a company as it changes over time, you can make predictions about where that company will be in the future. This dataset was also originally provided as part of a public Kaggle competition.

In this exercise, you'll plot the time series for a number of companies to get an understanding of how they are (or aren't) related to one another.

Latihan ini adalah bagian dari kursus

Machine Learning for Time Series Data in Python

Lihat Kursus

Petunjuk latihan

  • Import the data with Pandas (stored in the file 'prices.csv').
  • Convert the index of data to datetime.
  • Loop through each column of data and plot the the column's values over time.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Read in the data
data = pd.____('prices.csv', index_col=0)

# Convert the index of the DataFrame to datetime
data.index = ____(data.index)
print(data.head())

# Loop through each column, plot its values over time
fig, ax = plt.subplots()
for column in ____:
    data[column].plot(ax=ax, label=column)
ax.legend()
plt.show()
Edit dan Jalankan Kode