日付から特徴量を作る
もう一つの特徴量エンジニアリングとして、月と年を抽出してみましょう。ufo データセットの date 列に対してこの処理を行ってください。
この演習はコースの一部です
Pythonで学ぶMachine Learningの前処理
演習の手順
date列の.head()を出力します。date列から月の属性を取得します。date列から年の属性を取得します。date、month、yearの各列の.head()を確認します。
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# 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(____)