Using "date" information
It's easy to think of timestamps as pure numbers, but don't forget they generally correspond to things that happen in the real world. That means there's often extra information encoded in the data such as "is it a weekday?" or "is it a holiday?". This information is often useful in predicting timeseries data.
In this exercise, you'll extract these date/time based features. A single time series has been loaded in a variable called prices.
Diese Übung ist Teil des Kurses
Machine Learning for Time Series Data in Python
Anleitung zur Übung
- Calculate the day of the week, week number in a year, and month number in a year.
- Add each one as a column to the
prices_percDataFrame, under the namesday_of_week,week_of_yearandmonth_of_year, respectively.
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
# Extract date features from the data, add them as columns
prices_perc['day_of_week'] = prices_perc.____.____
prices_perc['week_of_year'] = prices_perc.____.____
prices_perc['month_of_year'] = prices_perc.____.____
# Print prices_perc
print(prices_perc)