Features from dates
Another feature engineering task to perform is month and year extraction. Perform this task on the date column of the ufo dataset.
Bu egzersiz
Preprocessing for Machine Learning in Python
kursunun bir parçasıdırEgzersiz talimatları
- Print out the
.head()of thedatecolumn. - Retrieve the month attribute of the
datecolumn. - Retrieve the year attribute of the
datecolumn. - Take a look at the
.head()of thedate,month, andyearcolumns.
Uygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
# Look at the first 5 rows of the date column
print(____)
# Extract the month from the date column
ufo["month"] = ufo["date"].____
# Extract the year from the date column
ufo["year"] = ufo["date"].____
# Take a look at the head of all three columns
print(____)