Regression with Date variable using Scikit-learn

后端 未结 4 2036
夕颜
夕颜 2020-12-13 09:43

I have a Pandas DataFrame with a date column (eg: 2013-04-01) of dtype datetime.date. When I include that column in X_train

4条回答
  •  悲哀的现实
    2020-12-13 10:25

    Before doing boolean encoding using the 1-of-K encoding suggested by @ogrisel, you may try enriching your data and playing with the number of features that you can extract from the datetime-type, i.e. day of week, day of month, day of year, week of year, quarter, etc. See for example https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DatetimeIndex.weekofyear.html and links to other functions.

提交回复
热议问题